Python PyQt4.QtCore.QString() Examples
The following are 30
code examples of PyQt4.QtCore.QString().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
PyQt4.QtCore
, or try the search function
.
Example #1
Source File: studiomaxuserprops.py From cross3d with MIT License | 6 votes |
def __setitem__(self, key, value): isDate = False if isinstance(value, QDate): value = value.toString('MM/dd/yyyy') isDate = True elif isinstance(value, date): value = value.strftime('%m/%d/%Y') isDate = True elif not isinstance(value, (float, int, str, unicode, QString)): value = repr(value) # addProperty is also setProperty if isDate: mxs.fileProperties.addProperty(self.customName, key, value, mxs.pyhelper.namify('date')) else: mxs.fileProperties.addProperty(self.customName, key, value) self.emitChange(key)
Example #2
Source File: gui_draw.py From interactive-deep-colorization with MIT License | 6 votes |
def update_ui(self, move_point=True): if self.ui_mode == 'none': return False is_predict = False snap_qcolor = self.calibrate_color(self.user_color, self.pos) self.color = snap_qcolor self.emit(SIGNAL('update_color'), QString('background-color: %s' % self.color.name())) if self.ui_mode == 'point': if move_point: self.uiControl.movePoint(self.pos, snap_qcolor, self.user_color, self.brushWidth) else: self.user_color, self.brushWidth, isNew = self.uiControl.addPoint(self.pos, snap_qcolor, self.user_color, self.brushWidth) if isNew: is_predict = True # self.predict_color() if self.ui_mode == 'stroke': self.uiControl.addStroke(self.prev_pos, self.pos, snap_qcolor, self.user_color, self.brushWidth) if self.ui_mode == 'erase': isRemoved = self.uiControl.erasePoint(self.pos) if isRemoved: is_predict = True # self.predict_color() return is_predict
Example #3
Source File: Youdao-Anki.py From Anki-Youdao with MIT License | 6 votes |
def setupHistoryList(self): self.table.clear() conn = sqlite3.connect('youdao-anki.db') cursor = conn.cursor() cursor.execute("select * from history where deckname='%s' order by id desc" % self.deckList.currentText()) values = cursor.fetchall() cursor.close() conn.close() # values[number of raw][0->id,1->terms,2->time] self.table.setColumnCount(2) self.table.setRowCount(len(values)) self.table.setHorizontalHeaderLabels(QString("Mark;Time;").split(";")) for index, day in enumerate(values): self.table.setItem(index, 1, QTableWidgetItem(str(day[2]))) mark = day[3] if mark is None: mark = 'N' self.table.setItem(index, 0, QTableWidgetItem(mark)) self.debug.appendPlainText('187: get sync history')
Example #4
Source File: setting.py From mishkal with GNU General Public License v3.0 | 6 votes |
def readSettings(self): settings = QtCore.QSettings("Arabeyes.org", "Qutrub") try: family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString() size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt(); bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool() dictsetting,ok=settings.value("DictSetting", QtCore.QVariant(1)).toInt(); except TypeError: family=settings.value("font_base_family", "Traditional Arabic") size=settings.value("font_base_size", "12") size= int(size) ok = bool(size) bold=settings.value("font_base_bold", True) bold = bool(bold) dictsetting =settings.value("DictSetting", "1") dictsetting = int(dictsetting) if not ok:size=12; self.font_result.setFamily(family) self.font_result.setPointSize(size) self.font_result.setBold(bold) #read of dictsetting options if not ok:dictsetting=1; ## self.BDictSetting.setCheckState(dictsetting);
Example #5
Source File: pressure.py From wacom-gui with GNU General Public License v3.0 | 6 votes |
def paintEvent(self, event): painter = QtGui.QPainter(self) painter.setRenderHints(QtGui.QPainter.Antialiasing) painter.fillRect(QtCore.QRectF(50, 50, 200, 200), QtGui.QBrush(QtGui.QColor(QtGui.QColor(110, 110, 110)))) painter.fillRect(QtCore.QRectF(50, 50, 200, 200), QtGui.QBrush(QtCore.Qt.CrossPattern)) painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.lightGray), 2, QtCore.Qt.SolidLine)) path = QtGui.QPainterPath() path.moveTo(50, 250) path.cubicTo(self.points[0][0], self.points[0][1], self.points[1][0], self.points[1][1], 250, 50) painter.drawPath(path) painter.setBrush(QtGui.QBrush(QtGui.QColor(QtCore.Qt.darkCyan))) painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.lightGray), 1)) #for x, y in pts: painter.drawEllipse(QtCore.QRectF(self.points[0][0] - 4, self.points[0][1] - 4, 8, 8)) painter.drawEllipse(QtCore.QRectF(self.points[1][0] - 4, self.points[1][1] - 4, 8, 8)) painter.setPen(QtGui.QPen(QtGui.QColor(QtCore.Qt.white), 1)) label1 = "("+ str((self.points[0][0] - 50)/2) + "," + str(100 - ((self.points[0][1] -50)/2)) + ")" painter.drawText(self.points[0][0] -25, self.points[0][1] + 18, QtCore.QString(label1)) label2 = "("+ str((self.points[1][0] - 50)/2) + "," + str(100 - ((self.points[1][1] -50)/2)) + ")" painter.drawText(self.points[1][0] -25, self.points[1][1] + 18, QtCore.QString(label2))
Example #6
Source File: ustr.py From LabelImgTool with MIT License | 5 votes |
def ustr(x): '''py2/py3 unicode helper''' if sys.version_info < (3, 0, 0): from PyQt4.QtCore import QString if type(x) == str: return x.decode('utf-8') if type(x) == QString: return unicode(x) return x else: return x # py3
Example #7
Source File: LicHelpers.py From lic with GNU General Public License v3.0 | 5 votes |
def getWeightsFile(): iniFile = os.path.join(partsCachePath(), 'weights.ini') return QSettings(QString(iniFile), QSettings.IniFormat)
Example #8
Source File: LicHelpers.py From lic with GNU General Public License v3.0 | 5 votes |
def getCodesFile(): iniFile = os.path.join(partsCachePath(), 'codes.ini') return QSettings(QString(iniFile), QSettings.IniFormat)
Example #9
Source File: ustr.py From labelImg2 with MIT License | 5 votes |
def ustr(x): '''py2/py3 unicode helper''' if sys.version_info < (3, 0, 0): from PyQt4.QtCore import QString if type(x) == str: return x.decode('utf-8') if type(x) == QString: return unicode(x) return x else: return x # py3
Example #10
Source File: GUIElements.py From FlatCAM with MIT License | 5 votes |
def returnPressed(self, *args, **kwargs): val = self.get_value() if val is not None: self.set_text(QtCore.QString(str(val))) else: log.warning("Could not interpret entry: %s" % self.text())
Example #11
Source File: PyQt_2.py From InplusTrader_Linux with MIT License | 5 votes |
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setMinimumSize(640, 430) #设置窗口最小尺寸 self.setGeometry(300, 300, 960, 650) self.setWindowTitle(QtCore.QString(u'行情实时走势-Test')) self.setStyleSheet("QWidget { background-color: black }") self.setWindowIcon(QtGui.QIcon('ruby.png')) self.setMouseTracking(True) self.m_x = 0 #光标x轴位置 self.m_y = 0 #光标y轴位置 self.stk_info = {} self.stk_info['name'] = u'' self.stk_info['code'] = u'' self.stk_info['market'] = '' self.stk_data = {} self.stk_data['list'] = {} #股价序列 self.stk_data['list']['time'] = [] #时间 self.stk_data['list']['open'] = [] #开盘价 self.stk_data['list']['high'] = [] #最高价 self.stk_data['list']['low'] = [] #最低价 self.stk_data['list']['close'] = [] #收盘价 self.stk_data['list']['vol'] = [] #成交量 self.stk_data['list']['amount']= [] #成交额 self.stk_data['list']['mma']= [] #分时均价 self.stk_data['list']['buy_port'] = [(0.00,0),(0.00,0),(0.00,0),(0.00,0),(0.00,0)] #买盘前五 self.stk_data['list']['sell_port'] = [(0.00,0),(0.00,0),(0.00,0),(0.00,0),(0.00,0)] #卖盘前五
Example #12
Source File: PyQt_2.py From InplusTrader_Linux with MIT License | 5 votes |
def timelinePaint(self): fw = self.metrics.width(u'00:00') #计算文字的宽度 sum_width = self.grid_padding_left+self.grid_padding_right sum_height = self.grid_padding_top+self.grid_padding_bottom grid_width = self.w-sum_width-2 y1 = self.grid_padding_top y2 = y1+(self.h-sum_height) #时间轴中线 self.setPen('red') x_pos = grid_width/2+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'11:30')) #时间轴09点30分 x_pos = self.grid_padding_left self.paint.drawText(x_pos,y2+12,QtCore.QString(u'09:30')) #时间轴10点30分 x_pos = grid_width*0.25+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'10:30')) #时间轴14点00分 x_pos = grid_width*0.75+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'14:00')) #时间轴15点00分 x_pos = grid_width+self.grid_padding_left self.paint.drawText(x_pos-fw,y2+12,QtCore.QString(u'15:00')) #时间虚线 by 30min self.setPen('red_1px_dashline') x_pos_array = [0.125,0.375,0.625,0.875] for i in x_pos_array: x_pos = grid_width*i+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2)
Example #13
Source File: drawMK.py From InplusTrader_Linux with MIT License | 5 votes |
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) self.setMinimumSize(640, 430) #设置窗口最小尺寸 self.setGeometry(300, 300, 960, 650) self.setWindowTitle(QtCore.QString(u'行情实时走势-Test')) self.setStyleSheet("QWidget { background-color: black }") self.setWindowIcon(QtGui.QIcon('ruby.png')) self.setMouseTracking(True) self.m_x = 0 #光标x轴位置 self.m_y = 0 #光标y轴位置 self.conn = MongoClient('172.18.181.134', 27017) self.Symbol_Db = self.conn.ifTrader_Symbol_Db self.Daily_Db = self.conn.ifTrader_Daily_Db self.OneMin_Db = self.conn.ifTrader_1Min_Db self.Tick_Db = self.conn.ifTrader_Tick_Db self.stk_info = {} self.stk_info['name'] = u'' self.stk_info['code'] = u'' self.stk_info['market'] = '' self.has_data = True self.stk_data = {} self.stk_data['list'] = {} #股价序列 self.stk_data['list']['time'] = [] #时间 self.stk_data['list']['open'] = [] #开盘价 self.stk_data['list']['high'] = [] #最高价 self.stk_data['list']['low'] = [] #最低价 self.stk_data['list']['close'] = [] #收盘价 self.stk_data['list']['vol'] = [] #成交量 self.stk_data['list']['amount']= [] #成交额 self.stk_data['list']['mma']= [] #分时均价 self.stk_data['list']['buy_port'] = [(0.00,0),(0.00,0),(0.00,0),(0.00,0),(0.00,0)] #买盘前五 self.stk_data['list']['sell_port'] = [(0.00,0),(0.00,0),(0.00,0),(0.00,0),(0.00,0)] #卖盘前五
Example #14
Source File: drawMK.py From InplusTrader_Linux with MIT License | 5 votes |
def topInfoPaint(self): self.setPen('yellow') self.paint.drawText(4+self.grid_padding_left,self.grid_padding_top-4 ,QtCore.QString(self.parent.stk_info['name'])) self.paint.drawText(4+self.grid_padding_left+120,self.grid_padding_top-4 ,QtCore.QString(u'均价线: ')) lastclose = self.parent.stk_data['lastclose'] close = self.parent.stk_data['close'] mma = self.parent.stk_data['list']['mma'][-1] if lastclose>close: #self.setPen('green') str_1 = '%.2f -%.2f'%(close, lastclose-close) if lastclose==close: #self.setPen('white') str_1 = '%.2f +%.2f'%(close, 0.00) if lastclose<close: #self.setPen('red') str_1 = '%.2f +%.2f'%(close, close-lastclose) if mma>close: self.setPen('green') if mma==close: self.setPen('white') if mma<close: self.setPen('red') self.paint.drawText(4+self.grid_padding_left+55,self.grid_padding_top-4,QtCore.QString(str_1)) self.paint.drawText(4+self.grid_padding_left+165,self.grid_padding_top-4,QtCore.QString('%.2f'%mma)) #均价 #涨停价 self.setPen('red') self.paint.drawText(4+self.grid_padding_left+200,self.grid_padding_top-4,QtCore.QString(u'涨停价:%.2f'%(lastclose*1.1))) #均价 #跌停价 self.setPen('green') self.paint.drawText(4+self.grid_padding_left+280,self.grid_padding_top-4,QtCore.QString(u'跌停价:%.2f'%(lastclose*0.9))) #均价
Example #15
Source File: drawMK.py From InplusTrader_Linux with MIT License | 5 votes |
def timelinePaint(self): fw = self.metrics.width(u'00:00') #计算文字的宽度 sum_width = self.grid_padding_left+self.grid_padding_right sum_height = self.grid_padding_top+self.grid_padding_bottom grid_width = self.w-sum_width-2 y1 = self.grid_padding_top y2 = y1+(self.h-sum_height) #时间轴中线 self.setPen('red') x_pos = grid_width/2+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'11:30')) #时间轴09点30分 x_pos = self.grid_padding_left self.paint.drawText(x_pos,y2+12,QtCore.QString(u'09:30')) #时间轴10点30分 x_pos = grid_width*0.25+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'10:30')) #时间轴14点00分 x_pos = grid_width*0.75+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2) self.paint.drawText(x_pos-fw/2,y2+12,QtCore.QString(u'14:00')) #时间轴15点00分 x_pos = grid_width+self.grid_padding_left self.paint.drawText(x_pos-fw,y2+12,QtCore.QString(u'15:00')) #时间虚线 by 30min self.setPen('red_1px_dashline') x_pos_array = [0.125,0.375,0.625,0.875] for i in x_pos_array: x_pos = grid_width*i+self.grid_padding_left self.paint.drawLine(x_pos,y1,x_pos,y2)
Example #16
Source File: GUIElements.py From FlatCAM with MIT License | 5 votes |
def __init__(self, label='', parent=None): super(FCCheckBox, self).__init__(QtCore.QString(label), parent)
Example #17
Source File: GUIElements.py From FlatCAM with MIT License | 5 votes |
def set_value(self, val): self.setText(QtCore.QString(str(val)))
Example #18
Source File: GUIElements.py From FlatCAM with MIT License | 5 votes |
def set_value(self, val): self.setText(QtCore.QString(str(val)))
Example #19
Source File: Threads.py From attify-badge with MIT License | 5 votes |
def run(self): try: while 1: if(self.ser.in_waiting): self.string=self.ser.read_all() self.emit(SIGNAL('update_console(QString)'), QtCore.QString(self.string)) except Exception as e: print("[*] Exception : "+str(e))
Example #20
Source File: abstractscene.py From cross3d with MIT License | 5 votes |
def property(self, key, default=None): """ \remarks returns a global scene value \param key <str> || <QString> \param default <variant> default value to return if no value was found \return <variant> """ return default
Example #21
Source File: gui_draw.py From interactive-deep-colorization with MIT License | 5 votes |
def set_color(self, c_rgb): c = QColor(c_rgb[0], c_rgb[1], c_rgb[2]) self.user_color = c snap_qcolor = self.calibrate_color(c, self.pos) self.color = snap_qcolor self.emit(SIGNAL('update_color'), QString('background-color: %s' % self.color.name())) self.uiControl.update_color(snap_qcolor, self.user_color) self.compute_result()
Example #22
Source File: appgui.py From mishkal with GNU General Public License v3.0 | 5 votes |
def readSettings(self): settings = QtCore.QSettings("Arabeyes.org", "Qutrub") try: family=settings.value("font_base_family", QtCore.QVariant(QString("Traditional Arabic"))).toString() except TypeError: family = str(settings.value("font_base_family", "Traditional Arabic")) try: size,ok=settings.value("font_base_size", QtCore.QVariant(12)).toInt(); except TypeError: size = settings.value("font_base_size", 12) size = int(size) ok = bool(size) if not ok:size=12; try: bold=settings.value("font_base_bold", QtCore.QVariant(True)).toBool() except TypeError: bold= bool(settings.value("font_base_bold", True)) self.font_result.setFamily(family) self.font_result.setPointSize(size) self.font_result.setBold(bold) #read of dictsetting options try: dictsetting,ok = settings.value("DictSetting", QtCore.QVariant(1)).toInt(); except TypeError: dictsetting = settings.value("DictSetting", 1); ok = bool(dictsetting) if not ok:dictsetting=1; self.BDictOption=dictsetting;
Example #23
Source File: quiz-controller.py From networkzero with MIT License | 5 votes |
def send_command(self, message=None, *args): if not message: commands = unicode(self.command.text()).encode("iso-8859-1").split() if not commands: core.log.warn("No command") return else: message, args = commands[0], commands[1:] args = [(unicode(arg) if isinstance(arg, QtCore.QString) else arg) for arg in args] command = "%s %s" % (message, " ".join(str(arg) for arg in args)) core.log.debug("send_command: %s", command) if hasattr(self, "command"): self.command.setText(command) self.instructions.put(message, *args)
Example #24
Source File: ustr.py From Interactive-image-segmentation-opencv-qt with MIT License | 5 votes |
def ustr(x): '''py2/py3 unicode helper''' if sys.version_info < (3, 0, 0): from PyQt4.QtCore import QString if type(x) == str: return x.decode('utf-8') if type(x) == QString: return unicode(x) return x else: return x # py3
Example #25
Source File: ddt4all.py From ddt4all with GNU General Public License v3.0 | 5 votes |
def set_dark_style(onoff): if (onoff): stylefile = core.QFile("qstyle.qss") stylefile.open(core.QFile.ReadOnly) if qt5: StyleSheet = str(stylefile.readAll()) else: StyleSheet = core.QString(core.QLatin1String(stylefile.readAll())) else: StyleSheet = "" app.setStyleSheet(StyleSheet)
Example #26
Source File: ai.py From crazyflieROS with GNU General Public License v2.0 | 5 votes |
def drawStats(self, qp): defaultCol = QColor(0,255,0, 200) #qp = QtGui.QPainter() qp.resetTransform() w = self.width() h = self.height() top = 50 bottom = h-50 width, height = w*0.2, 22 dist = 10 space = height+dist pos = width/4 # DRAW PROGRESS BAGS (left) if self.bat>-1: self.drawBar(qp, QRectF(pos, top+space*0, width,height), defaultCol, 'BAT %4.2fV'%(self.bat/1000.), self.bat, 3000, 4150) if self.link>-1: self.drawBar(qp, QRectF(pos, top+space*1, width,height), defaultCol, 'SIG %03d%%'%self.link, self.link) if self.cpu>-1: self.drawBar(qp, QRectF(pos, top+space*2, width,height), defaultCol, 'CPU %03d%%'%self.cpu, self.cpu) # DRAW RAW STATS( right) pos = w-width/4-width/2 space = height+2 if self.pktsOut>-1: qp.drawText(QRectF(pos, top+space*0, width,height), Qt.AlignLeft, '%04d kb/s'%self.pktsOut) if self.pktsIn>-1: qp.drawText(QRectF(pos, top+space*1, width,height), Qt.AlignLeft, '%04d kb/s'%self.pktsIn) if self.pressure>-1: qp.drawText(QRectF(pos, top+space*3, width,height), Qt.AlignLeft, '%06.2f hPa'%self.pressure) if self.temp>-1: qp.drawText(QRectF(pos, top+space*4, width,height), Qt.AlignLeft, QString('%05.2f'%self.temp)+QChar(0260)+QString("C")) if self.aslLong>-1: qp.drawText(QRectF(pos, top+space*5, width,height), Qt.AlignLeft, '%4.2f m'%self.aslLong)
Example #27
Source File: abstractscene.py From cross3d with MIT License | 5 votes |
def _toNativeValue(self, pyValue): """ \remarks [virtual] converts the inputed value from Qt/Python to whatever value is required for the native application \param pyValue <variant> \return <variant> """ from PyQt4.QtCore import QString # we should not pass back QString value's to an application, as they will not expect it. Standard python strings/unicodes will be auto-converted if (type(pyValue) == QString): return unicode(pyValue) # by default, we assume that any other type can be naturally processed return pyValue
Example #28
Source File: GUIElements.py From FlatCAM with MIT License | 5 votes |
def set_value(self, val): if val == self.empty_val and self.allow_empty: self.setText(QtCore.QString("")) return self.setText(QtCore.QString(str(val)))
Example #29
Source File: abstractscene.py From cross3d with MIT License | 5 votes |
def setProperty(self, key, value): """ \remarks sets the global scene property to the inputed value \param key <str> || <QString> \param value <variant> \return <bool> """ return False
Example #30
Source File: xmldocument.py From cross3d with MIT License | 5 votes |
def parse(self, xmlString): success = False if isinstance(xmlString, QString): xmlString = unicode(xmlString) else: xmlString = xmlString.encode('utf-8') if (xmlString): tempObject = xml.dom.minidom.parseString(xmlString) if (tempObject): self._object = tempObject success = True return success