我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PyQt4.QtCore.QString()。
def __init__(self, parent=None): super(Test, self).__init__(parent) self.setupUi(self) self._connect_init() self.linphone = CoreManager(self.preview_view_winId, self.remote_view_winId, self.registration_cb, self.incoming_cb) #test self.username_input.setText(QtCore.QString(u'1111')) self.password_input.setText(QtCore.QString(u'123')) self.domain_input.setText(QtCore.QString(u'192.168.123.97')) self.transport_combo.setCurrentIndex(2) self.save_event()
def on_Backup_clicked(self): """ Backup the hosts file of current operating system. .. note:: This method is the slot responses to the signal from ButtonBackup widget while the button is clicked. """ l_time = time.localtime(time.time()) backtime = time.strftime("%Y-%m-%d-%H%M%S", l_time) filename = "hosts_" + backtime + ".bak" if self.platform == "OS X": filename = "/Users/" + filename filepath = QtGui.QFileDialog.getSaveFileName( self, _translate("Util", "Backup hosts", None), QtCore.QString(filename), _translate("Util", "Backup File(*.bak)", None)) if unicode(filepath) != u'': shutil.copy2(self.hosts_path, unicode(filepath)) self.info_complete()
def on_Restore_clicked(self): """ Restore a previously backed up hosts file. .. note:: This method is the slot responses to the signal from ButtonRestore widget while the button is clicked. This method would call .. note:: No operations would be called if current session does not have the privileges to change the hosts file. """ if not self._writable: self.warning_permission() return filename = '' if self.platform == "OS X": filename = "/Users/" + filename filepath = QtGui.QFileDialog.getOpenFileName( self, _translate("Util", "Restore hosts", None), QtCore.QString(filename), _translate("Util", "Backup File(*.bak)", None)) if unicode(filepath) != u'': shutil.copy2(unicode(filepath), self.hosts_path) self.info_complete()
def export_hosts(self): """ Display the export dialog and get the path to save the exported hosts file. :return: Path to export a hosts file. :rtype: str """ filename = "hosts" if self.platform == "OS X": filename = "/Users/" + filename filepath = QtGui.QFileDialog.getSaveFileName( self, _translate("Util", "Export hosts", None), QtCore.QString(filename), _translate("Util", "hosts File", None)) return filepath
def mouseMoveEvent(self, mouseEvent): if not self.clickedInScrollBar: if self.scrolling: if not self.handIsClosed: QApplication.restoreOverrideCursor() QApplication.setOverrideCursor(QtCore.Qt.ClosedHandCursor) self.handIsClosed = True delta = mouseEvent.pos() - self.position p = self.offset - delta frame = self.page().mainFrame() frame.evaluateJavaScript(QString("window.scrollTo(%1, %2);").arg(p.x()).arg(p.y())); return if self.pressed: self.pressed = False self.scrolling = True return return QWebView.mouseMoveEvent(self, mouseEvent)
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.setupUi(self) QObject.connect(self.selectButton, SIGNAL("clicked()"),self.fillInputFileEdit) QObject.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib) QObject.connect(self.selectButton3, SIGNAL("clicked()"), self.fillOutputFileEdit) QObject.connect(self.buttonAdd, SIGNAL("clicked()"), self.actionAdd) QObject.connect(self.buttonRemove, SIGNAL("clicked()"), self.actionRemove) QObject.connect(self.buttonBox, SIGNAL("accepted()"), self.convert) QObject.connect(self.buttonAttribute, SIGNAL("clicked()"), self.attributeTable) # connect help QObject.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Help), SIGNAL("clicked()"), self.help) # INPUT VECTOR FILE
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.setupUi(self) QObject.connect(self.selectButton, SIGNAL("clicked()"),self.fillInputFileEdit) QObject.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib) QObject.connect(self.selectButton3, SIGNAL("clicked()"), self.fillOutputFileEdit) QObject.connect(self.buttonAdd, SIGNAL("clicked()"), self.actionAdd) QObject.connect(self.buttonRemove, SIGNAL("clicked()"), self.actionRemove) QObject.connect(self.buttonBox, SIGNAL("accepted()"), self.convert) # connect help QObject.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Help), SIGNAL("clicked()"), self.help) # INPUT VECTOR FILE
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.setupUi(self) QObject.connect(self.selectButton, SIGNAL("clicked()"),self.fillInputFileEdit) QObject.connect(self.selectButton1, SIGNAL("clicked()"),self.fillInputFileEdit1) QObject.connect(self.selectButton2, SIGNAL("clicked()"),self.fillInputFileEdit2) QObject.connect(self.selectButton4, SIGNAL("clicked()"),self.fillInputFileEdit4) QObject.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib) QObject.connect(self.inputLayerCombo1, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib1) QObject.connect(self.inputLayerCombo2, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib2) QObject.connect(self.selectButton3, SIGNAL("clicked()"), self.fillOutputFileEdit) QObject.connect(self.buttonAdd, SIGNAL("clicked()"), self.actionAdd) QObject.connect(self.buttonRemove, SIGNAL("clicked()"), self.actionRemove) QObject.connect(self.buttonBox, SIGNAL("accepted()"), self.convert) # connect help QObject.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Help), SIGNAL("clicked()"), self.help) # METHOD I # INPUT VECTOR FILE PRECIPITATION
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.setupUi(self) QObject.connect(self.selectButton, SIGNAL("clicked()"),self.fillInputFileEdit) QObject.connect(self.selectMask, SIGNAL("clicked()"),self.fillInputMask) QObject.connect(self.selectButton_mdt, SIGNAL("clicked()"),self.fillInputMDT) QObject.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib) QObject.connect(self.selectButton3, SIGNAL("clicked()"), self.fillOutputFileEdit) QObject.connect(self.buttonAdd, SIGNAL("clicked()"), self.actionAdd) QObject.connect(self.buttonRemove, SIGNAL("clicked()"), self.actionRemove) QObject.connect(self.buttonBox, SIGNAL("accepted()"), self.convert) # connect help QObject.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Help), SIGNAL("clicked()"), self.help) # INPUT VECTOR FILE
def __init__(self, iface): QDialog.__init__(self) self.iface = iface self.setupUi(self) QObject.connect(self.selectButton, SIGNAL("clicked()"),self.fillInputFileEdit) QObject.connect(self.inputLayerCombo, SIGNAL("currentIndexChanged(QString)"), self.fillInputAttrib) QObject.connect(self.selectButton_dem, SIGNAL("clicked()"),self.fillInputRasterEdit) QObject.connect(self.selectButton3, SIGNAL("clicked()"), self.fillOutputFileEdit) QObject.connect(self.buttonAdd, SIGNAL("clicked()"), self.actionAdd) QObject.connect(self.buttonRemove, SIGNAL("clicked()"), self.actionRemove) QObject.connect(self.buttonBox, SIGNAL("accepted()"), self.convert) #self.btnCancel = self.buttonBox.button( QDialogButtonBox.Cancel ) #QObject.connect(self.btnCancel, SIGNAL( "clicked()" ), self.stopProcessing) # connect help QObject.connect(self.buttonBox.button(QtGui.QDialogButtonBox.Help), SIGNAL("clicked()"), self.help) self.buttonBox.button(QDialogButtonBox.Ok).setDefault(True) # INPUT VECTOR FILE
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')
def about_window(self): QtGui.QMessageBox.about( self, 'About Krakrobot Python Simulator ' + __version__, QtCore.QString(__about__ + '\n') + \ QtCore.QString('\n' + __website__ + '\n') + \ QtCore.QString('\n' + __authors__ + '\n') + \ QtCore.QString( 'https://github.com/uj-robotics/Krakrobot2014Qualifications\n' ) + \ QtCore.QString('\nLicense: ' + __license__ + '\n') + \ QtCore.QString( """Copyright (c) 2013-2014 """ """Jagiellonian University Robotics Interest Group,""" """http://www.robotics.ii.uj.edu.pl/""" ) )
def setName(self, name): print 'son qui' print self.splitted_values[0][392:406] if isinstance(name, QtCore.QString): name = unicode(name.toUtf8(), encoding='utf-8') name = name.ljust(14) name_values = [] for char in name: if char == u'°': name_values.append(127) else: name_values.append(ord(char)) for wt_data in self.splitted_values: wt_data[392:406] = name_values print 'ok' print self.splitted_values[0][392:406]
def focusOutEvent(self, event): if self.text == self.editing_text: BaseTextWidget.focusOutEvent(self, event) self.ungrabKeyboard() self.cursor_timer.stop() self.cursor.hide() self.editing = False self.update() return new_text = QtCore.QString.fromUtf8('Save sound name to "{}"?'.format(self.editing_text.toUtf8())) res = QtGui.QMessageBox.question(self.main.scene().views()[0].window(), 'Save sound name?', new_text, QtGui.QMessageBox.Yes|QtGui.QMessageBox.No|QtGui.QMessageBox.Cancel) if res == QtGui.QMessageBox.Cancel: self.ungrabKeyboard() self.grabKeyboard() self.setFocus(QtCore.Qt.OtherFocusReason) return BaseTextWidget.focusOutEvent(self, event) self.ungrabKeyboard() self.cursor_timer.stop() self.cursor.hide() self.editing = False if res == QtGui.QMessageBox.Yes: if self.text != self.editing_text: self.check_changes() self.update()
def wavelistDragEnterEvent(self, event): for fmt in event.mimeData().formats(): if fmt.toLower().contains('text') or fmt.toLower().contains('string'): s = QtCore.QString(event.mimeData().data(fmt)) if s.startsWith('file://'): try: path = str(QtCore.QUrl(s).toLocalFile()) source = wave.open(path) if source.getnchannels() > 2 or source.getsampwidth() > 2: raise framerate = source.getframerate() frames = source.getnframes() if frames/float(framerate) > 60: raise break except: continue else: event.ignore() return event.accept() self.wave_accepted_fmt = fmt
def saveImageToDisk(self): """ This saves an image in page directly without downloading""" pm = self.page().mainFrame().hitTestContent(self.rel_pos).pixmap() url = self.page().mainFrame().hitTestContent(self.rel_pos).imageUrl() url.setFragment(QtCore.QString()) url.setQueryItems([]) filepath = url.toString() if QtCore.QFileInfo(filepath).suffix() not in ['jpg', 'jpeg', 'png'] : filepath = os.path.splitext(unicode(filepath))[0] + '.jpg' filepath = QtGui.QFileDialog.getSaveFileName(self, "Select Image to Save", downloaddir + QtCore.QFileInfo(filepath).fileName(), "All Images (*.jpg *.jpeg *.png);;JPEG File (*.jpg);;PNG File (*.png)" ) if not filepath.isEmpty(): if pm.save(filepath): QtGui.QMessageBox.information(self, "Successful !","Image %s \nhas been successfully saved!"%QtCore.QFileInfo(filepath).fileName())
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
def get_save_filename (parent): """Open file save dialog for given parent window and base directory. Return dialog result.""" title = _("Save check results") func = QtGui.QFileDialog.getSaveFileName logtype = parent.saveresultas if parent.saveresultas else 'html' filters = ";;".join(sortwithfirst(LoggerFilters, Logtype2Filter[logtype])) filename = "linkchecker-out" + Logtype2FileExt[logtype] selectedFilter = QtCore.QString() res = func(parent, title, filename, filters, selectedFilter) logtype = Filter2Logtype.get(unicode(selectedFilter)) return res, logtype
def __init__(self, html, resolution): QWebView.__init__(self) self.resolution = resolution self.finished = False self.out = "web2png.%i.png"%int(random.randint(0,1000)) #self.web_view = QWebView() #self.css_file = QString('/home/ddimitrov/wikiwsd/data/wikipedia_css.css') #path = os.getcwd() #self.settings().setAttribute(QWebSettings.LocalContentCanAccessRemoteUrls, True) #self.settings().setAttribute(QWebSettings.LocalContentCanAccessFileUrls, True) #self.web_view.settings().setUserStyleSheetUrl(QUrl.fromLocalFile("wikipedia_css.css")) #self.web_view.settings().setUserStyleSheetUrl(QUrl.fromLocalFile(QString('file:///home/ddimitrov/wikiwsd/wikipedia_css.css'))) #print self.web_view.settings().userStyleSheetUrl() #self.web_view.settings().setAttribute(QWebSettings.AutoLoadImages, False) #self.web_view.settings().setAttribute(QWebSettings.JavascriptEnabled, False) #self.setCentralWidget(self.web_view) #self.resize(resolution[0], resolution[1]) self.loadFinished.connect(self._load_finished) #self.loadProgress.connect(self._loadProgress) self.setHtml(html) #self.page_length = None #self.positions = None #self.out = "web2png.%i.png"%int(time.time())
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)
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))) #??
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)] #????
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)] #????
def incoming_cb(self, number): self.incoming_display.setText(QtCore.QString(number))
def registration_cb(self, state): self.register_state_display.setText(QtCore.QString(state))
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)
def setCompleter(self, completer): if self.completer: self.disconnect(self.completer, 0, self, 0) if not completer: return completer.setWidget(self) completer.setCompletionMode(QtGui.QCompleter.PopupCompletion) completer.setCaseSensitivity(QtCore.Qt.CaseInsensitive) self.completer = completer self.connect(self.completer, QtCore.SIGNAL("activated(const QString&)"), self.insertCompletion)
def itemSelected(self, item): font = item.font() color = item.defaultTextColor() self.fontCombo.setCurrentFont(font) self.fontSizeCombo.setEditText(QtCore.QString().setNum(font.pointSize())) self.boldAction.setChecked(font.weight() == QtGui.QFont.Bold) self.italicAction.setChecked(font.italic()) self.underlineAction.setChecked(font.underline())
def loadFields(self, vectorFile = QString()): if vectorFile == None: return try: (fields, names) = Utils.getVectorFields(vectorFile) except Exception, e: QErrorMessage(self).showMessage( str(e) ) self.inputLayerCombo.clearEditText() ncodec = QTextCodec.codecForName(self.lastEncoding)
def loadFields(self, vectorFile = QString()): if vectorFile == None: return try: (fields, names) = Utils.getVectorFields(vectorFile) except Exception, e: QErrorMessage(self).showMessage( str(e) ) self.inputLayerCombo.clearEditText() ncodec = QTextCodec.codecForName(self.lastEncoding) # ------------------------------ // ------------------------------------ // ----------------------------
def loadFields1(self, vectorFile = QString()): if vectorFile == None: return try: (fields, names) = Utils.getVectorFields(vectorFile) except Exception, e: QErrorMessage(self).showMessage( str(e) ) self.inputLayerCombo1.clearEditText() ncodec = QTextCodec.codecForName(self.lastEncoding) # INPUT VECTOR FILE EVAPOTRANSPIRATION
def loadFields(self, vectorFile = QString()): if vectorFile == None: return try: (fields, names) = Utils.getVectorFields(vectorFile) except Exception, e: QErrorMessage(self).showMessage( str(e) ) self.inputLayerCombo.clearEditText() ncodec = QTextCodec.codecForName(self.lastEncoding) # INPUT MASK SHAPEFILE
def mouseMoveEvent(self, event): if self._pan: self.horizontalScrollBar().setValue(self.horizontalScrollBar().value() - (event.x() - self._panStartX)) self.verticalScrollBar().setValue(self.verticalScrollBar().value() - (event.y() - self._panStartY)) self._panStartX = event.x() self._panStartY = event.y() if self._draw: self.scene.removeItem(self._lstRect) sceneCoord = self.mapToScene(event.pos()) tl = QtCore.QPointF(max(min(self._drawStartX, sceneCoord.x())-2, 0), max(min(self._drawStartY, sceneCoord.y())-2, 0)) br = QtCore.QPointF(min(max(self._drawStartX, sceneCoord.x()-1)+2, self.scene.sceneRect().width()), min(max(self._drawStartY, sceneCoord.y()-1)+2, self.scene.sceneRect().height())) self._lstRect = QStrokeRect(QtCore.QRectF(tl, br)) self._lstRect.setPen(self.pen) self._lstRect.setStrokeWidth(6) self.scene.addItem(self._lstRect) self._moved = True event.accept() QtGui.QGraphicsView.mouseMoveEvent(self, event) sceneCoord = self.mapToScene(event.pos()) sceneRect = self.scene.sceneRect() if sceneRect.contains(sceneCoord): self.emit(QtCore.SIGNAL("sendSceneCoord(QString)"), QtCore.QString('{:04.2f}, {:04.2f}'.format(sceneCoord.x(), sceneCoord.y()))) if not self._pan and not self._draw: self.selItem = self.scene.itemAt(sceneCoord) if self.selItem is not None and self.selItem.type() != 7: # 7 is QGraphicsPixmapItem self.viewport().setCursor(QtCore.Qt.ArrowCursor) self._sel = True else: self.viewport().setCursor(QtCore.Qt.CrossCursor) self._sel = False else: self.emit(QtCore.SIGNAL("sendSceneCoord(QString)"), '')
def __init__ (self, value): super(QNumericSortTableWidgetItem, self).__init__(QtCore.QString('%s' % value))
def keyPressEvent(self, event): if event.isAutoRepeat(): return self.key = QtCore.QString() if Qt.Key_A <= event.key() <= Qt.Key_Z: self.key = event.text() self.flags.isLatch_button = True self.key = event.text() self.ui.latch.setStyleSheet('background-color :rgbrgb(0, 131, 0);')
def onOut(self): data = self.chestProc.readAllStandardOutput() self.output.insertPlainText(QtCore.QString(data)) # TODO #1: add break for big output
def onError(self): self.output.setTextColor(QtGui.QColor(255, 0, 0)) self.output.insertPlainText(QtCore.QString( self.chestProc.readAllStandardError())) self.output.setTextColor(QtGui.QColor(0, 0, 0))
def stopPopeye(self): self.stop_requested = True self.process.kill() self.output.insertPlainText(QtCore.QString( "\n" + Lang.value('MSG_Terminated')))