def __createLayout(self): """ Creates the dialog layout """ self.resize(579, 297) self.setSizeGripEnabled(True) self.gridlayout = QGridLayout(self) self.descriptionLabel = QLabel(self) self.descriptionLabel.setText("Description:") self.gridlayout.addWidget(self.descriptionLabel, 0, 0, 1, 1) self.descriptionEdit = QLineEdit(self) self.gridlayout.addWidget(self.descriptionEdit, 0, 1, 1, 3) sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) self.completedCheckBox = QCheckBox(self) self.completedCheckBox.setText("Completed") sizePolicy = QSizePolicy(QSizePolicy.Expanding, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth( self.completedCheckBox.sizePolicy().hasHeightForWidth()) self.completedCheckBox.setSizePolicy(sizePolicy) self.gridlayout.addWidget(self.completedCheckBox, 3, 3, 1, 1) self.filenameLabel = QLabel(self) self.filenameLabel.setText("File name:") self.gridlayout.addWidget(self.filenameLabel, 4, 0, 1, 1) self.filenameEdit = QLineEdit(self) self.filenameEdit.setFocusPolicy(Qt.NoFocus) self.filenameEdit.setReadOnly(True) self.gridlayout.addWidget(self.filenameEdit, 4, 1, 1, 3) self.lineLabel = QLabel(self) self.lineLabel.setText("Line:") self.gridlayout.addWidget(self.lineLabel, 5, 0, 1, 1) self.linenoEdit = QLineEdit(self) self.linenoEdit.setFocusPolicy(Qt.NoFocus) self.linenoEdit.setReadOnly(True) self.gridlayout.addWidget(self.linenoEdit, 5, 1, 1, 3) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | \ QDialogButtonBox.Ok ) self.gridlayout.addWidget(self.buttonBox, 6, 0, 1, 4) self.descriptionLabel.setBuddy(self.descriptionEdit) self.buttonBox.accepted.connect(self.accept) self.buttonBox.rejected.connect(self.reject) QMetaObject.connectSlotsByName(self) self.setTabOrder(self.completedCheckBox, self.buttonBox) return
def run(self): """ Reimplemented from `QRunnable.run` """ self.eventLoop = QEventLoop() self.eventLoop.processEvents() # Move the task to the current thread so it's events, signals, slots # are triggered from this thread. assert isinstance(self.task.thread(), _TaskDepotThread) QMetaObject.invokeMethod(self.task.thread(), "transfer", Qt.BlockingQueuedConnection, Q_ARG(object, self.task), Q_ARG(object, QThread.currentThread())) self.eventLoop.processEvents() # Schedule task.run from the event loop. self.task.start() # Quit the loop and exit when task finishes or is cancelled. # TODO: If the task encounters an critical error it might not emit # these signals and this Runnable will never complete. self.task.finished.connect(self.eventLoop.quit) self.task.cancelled.connect(self.eventLoop.quit) self.eventLoop.exec_()
def __init__(self, message=None, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(authorizationPopUp, self).__init__(parent) self.setupUi(self) # Valores por defecto de las variables a retornar self.value0, self.value1 = None, None # Configurar resolucion del popUp #self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "authorizationPopUp") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def setupUi(self, dialog, nepomukType=None, excludeList=None): self.dialog = dialog dialog.setObjectName("dialog") dialog.resize(500, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = ResourcesByTypeTable(mainWindow=dialog.parent(), nepomukType=nepomukType, excludeList=excludeList, dialog=self) self.table.table.setColumnWidth(0, 250) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.table.table.activated.connect(self.activated) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def run(self): """ Reimplemented from `QRunnable.run` """ self.eventLoop = QEventLoop() self.eventLoop.processEvents() # Move the task to the current thread so it's events, signals, slots # are triggered from this thread. assert self.task.thread() is _TaskDepotThread.instance() QMetaObject.invokeMethod( self.task.thread(), "transfer", Qt.BlockingQueuedConnection, Q_ARG(object, self.task), Q_ARG(object, QThread.currentThread()) ) self.eventLoop.processEvents() # Schedule task.run from the event loop. self.task.start() # Quit the loop and exit when task finishes or is cancelled. self.task.finished.connect(self.eventLoop.quit) self.task.cancelled.connect(self.eventLoop.quit) self.eventLoop.exec_()
def _show_backup_decision(self, error=None): text = '<p>{0}</p><p>{1}</p>'.format( self.BACKUP_INTRO_TEXT if error is None else error, self.BACKUP_PROMPT_TEXT, ) dialog = QMessageBox( QMessageBox.Question if error is None else QMessageBox.Critical, self.BACKUP_DIALOG_CAPTION if error is None else self.BACKUP_DIALOG_ERROR_CAPTION, text, ) revert_button = dialog.addButton(self.REVERT_BACKUP_BUTTON_TEXT, QMessageBox.AcceptRole) delete_button = dialog.addButton(self.DELETE_BACKUP_BUTTON_TEXT, QMessageBox.DestructiveRole) examine_button = dialog.addButton(self.EXAMINE_BACKUP_BUTTON_TEXT, QMessageBox.ActionRole) dialog.addButton(self.QUIT_BUTTON_TEXT, QMessageBox.RejectRole) dialog.exec() clicked_button = dialog.clickedButton() if clicked_button == examine_button: QMetaObject.invokeMethod(self, '_examine_backup', Qt.QueuedConnection) elif clicked_button == revert_button: self._progress_dialog = QProgressDialog(None) self._progress_dialog.setLabelText(self.REVERT_BACKUP_PROGRESS_TEXT) self._progress_dialog.setCancelButton(None) self._progress_dialog.setRange(0, 0) self._progress_dialog.forceShow() self.request_revert_backup.emit() elif clicked_button == delete_button: self.request_delete_backup.emit() else: self.quit()
def setupUi(self): self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.infoText = QTextEdit() numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber) text = self.tr('You can refer to model values in your formula, using ' 'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog') ichar = 97 if numbers: for number in numbers: text += chr(ichar) + '->' + self.resolveValueDescription(number) + '\n' ichar += 1 else: text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog') self.infoText.setText(text) self.infoText.setEnabled(False) self.formulaText = QLineEdit() if hasattr(self.formulaText, 'setPlaceholderText'): self.formulaText.setPlaceholderText(self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog')) self.setWindowTitle(self.tr('Calculator', 'CalculatorModelerParametersDialog')) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(2) self.verticalLayout.setMargin(0) self.verticalLayout.addWidget(self.infoText) self.verticalLayout.addWidget(self.formulaText) self.verticalLayout.addWidget(self.buttonBox) self.setLayout(self.verticalLayout) QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed) QMetaObject.connectSlotsByName(self)
def setupUi(self, dialog, nepomukType=None, excludeList=None): self.dialog = dialog dialog.setObjectName("dialog") dialog.resize(500, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = ResourcesByTypeTable(mainWindow=dialog.parent(), nepomukType=nepomukType, excludeList=excludeList, dialog=self) self.table.table.setColumnWidth(0,250) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.table.table.activated.connect(self.activated) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def run(self): """ Reimplemented from `QRunnable.run` """ self.eventLoop = QEventLoop() self.eventLoop.processEvents() # Move the task to the current thread so it's events, signals, slots # are triggered from this thread. assert isinstance(self.task.thread(), _TaskDepotThread) QMetaObject.invokeMethod( self.task.thread(), "transfer", Qt.BlockingQueuedConnection, Q_ARG(object, self.task), Q_ARG(object, QThread.currentThread()) ) self.eventLoop.processEvents() # Schedule task.run from the event loop. self.task.start() # Quit the loop and exit when task finishes or is cancelled. # TODO: If the task encounters an critical error it might not emit # these signals and this Runnable will never complete. self.task.finished.connect(self.eventLoop.quit) self.task.cancelled.connect(self.eventLoop.quit) self.eventLoop.exec_()
def setupUi(self, SLim): SLim.setObjectName(_fromUtf8("SLim")) SLim.resize(800, 601) self.centralwidget = QWidget(SLim) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.verticalLayout = QVBoxLayout(self.centralwidget) self.verticalLayout.setObjectName(_fromUtf8("verticalLayout")) SLim.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(SLim) self.menubar.setGeometry(QRect(0, 0, 800, 20)) self.menubar.setObjectName(_fromUtf8("menubar")) SLim.setMenuBar(self.menubar) self.statusbar = QStatusBar(SLim) self.statusbar.setObjectName(_fromUtf8("statusbar")) SLim.setStatusBar(self.statusbar) ui_settings = slimUISettings() QMetaObject.connectSlotsByName(SLim) self.loopers = [] self.loopers.append(LooperWidget(self.centralwidget, 0, ui_settings.looper)) self.loopers.append(LooperWidget(self.centralwidget, 1, ui_settings.looper)) for looper in self.loopers: self.verticalLayout.addWidget(looper) self.retranslateUi(SLim)
def __init__(self, message=None, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(errorPopUp, self).__init__(parent) self.setupUi(self) # Configurar mensaje del popUp if message != None: self.dtitle0.setText(message) # Configurar resolucion del popUp self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "errorPopUp") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def setupUi(self, dialog): dialog.setObjectName("dialog") self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.table = TypesTable(mainWindow=dialog.mainWindow, typesUris=self.typesUris, dialog=self) self.gridlayout.addWidget(self.table, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) self.setWindowTitle(i18n("Types")) QMetaObject.connectSlotsByName(dialog)
def __createLayout( self ): """ Creates the dialog layout """ self.resize( 579, 297 ) self.setSizeGripEnabled( True ) self.gridlayout = QGridLayout( self ) self.descriptionLabel = QLabel( self ) self.descriptionLabel.setText( "Description:" ) self.gridlayout.addWidget( self.descriptionLabel, 0, 0, 1, 1 ) self.descriptionEdit = QLineEdit( self ) self.gridlayout.addWidget( self.descriptionEdit, 0, 1, 1, 3 ) sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Preferred ) sizePolicy.setHorizontalStretch( 0 ) sizePolicy.setVerticalStretch( 0 ) self.completedCheckBox = QCheckBox( self ) self.completedCheckBox.setText( "Completed" ) sizePolicy = QSizePolicy( QSizePolicy.Expanding, QSizePolicy.Fixed ) sizePolicy.setHorizontalStretch( 0 ) sizePolicy.setVerticalStretch( 0 ) sizePolicy.setHeightForWidth( self.completedCheckBox.sizePolicy().hasHeightForWidth() ) self.completedCheckBox.setSizePolicy( sizePolicy ) self.gridlayout.addWidget( self.completedCheckBox, 3, 3, 1, 1 ) self.filenameLabel = QLabel( self ) self.filenameLabel.setText( "File name:" ) self.gridlayout.addWidget( self.filenameLabel, 4, 0, 1, 1 ) self.filenameEdit = QLineEdit( self ) self.filenameEdit.setFocusPolicy( Qt.NoFocus ) self.filenameEdit.setReadOnly( True ) self.gridlayout.addWidget( self.filenameEdit, 4, 1, 1, 3 ) self.lineLabel = QLabel( self ) self.lineLabel.setText( "Line:" ) self.gridlayout.addWidget( self.lineLabel, 5, 0, 1, 1 ) self.linenoEdit = QLineEdit( self ) self.linenoEdit.setFocusPolicy( Qt.NoFocus ) self.linenoEdit.setReadOnly( True ) self.gridlayout.addWidget( self.linenoEdit, 5, 1, 1, 3 ) self.buttonBox = QDialogButtonBox( self ) self.buttonBox.setOrientation( Qt.Horizontal ) self.buttonBox.setStandardButtons( QDialogButtonBox.Cancel | \ QDialogButtonBox.Ok ) self.gridlayout.addWidget( self.buttonBox, 6, 0, 1, 4 ) self.descriptionLabel.setBuddy( self.descriptionEdit ) self.buttonBox.accepted.connect( self.accept ) self.buttonBox.rejected.connect( self.reject ) QMetaObject.connectSlotsByName( self ) self.setTabOrder( self.completedCheckBox, self.buttonBox ) return
def run(self): ret = None try: if self.object is not None and self.method is not None: # TODO Get return value. QMetaObject.invokeMethod(self.object, self.method, self.connection) except Exception, e: self.error.emit(e, traceback.format_exc())
def done(self): self.timer.stop() self.popup.hide() self.editor.setFocus() item = self.popup.currentItem() if item: self.editor.setText(item.text(0)) QMetaObject.invokeMethod(self.editor, "returnPressed")
def init_window(cls): cls.slot_func = SlotFunc(cls) cls.init_widget() cls.init_button() cls.init_menu() cls.set_style_sheet() cls.init_text() cls.add_slot_func() QMetaObject.connectSlotsByName(WINDOW)
def setupUi(self): self.setObjectName(u'splash_screen') self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.setContextMenuPolicy(Qt.PreventContextMenu) splash_image = QPixmap(u':/icons/128/luma') self.setPixmap(splash_image) self.setMask(splash_image.mask()) self.resize(128, 128) QMetaObject.connectSlotsByName(self)
def doneCompletion(self): self.timer.stop() self.ui.popup.hide() self.ui.editor.setFocus() item = self.ui.popup.currentItem() if item != None: self.currentItem = self.ui.popup.currentItem().data(0,0) self.ui.editor.setText(item.text(self.textplacetoeditor)) QMetaObject.invokeMethod(self.ui.editor, "returnPressed");
def setupUi(self, TestLayout): TestLayout.setObjectName("ListEdit") TestLayout.resize(440,240) self.centralwidget = QtGui.QWidget(TestLayout) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.editBox = QtGui.QLineEdit(self.centralwidget) self.editBox.setObjectName("editBox") self.verticalLayout.addWidget(self.editBox) self.listBox = QtGui.QListWidget(self.centralwidget) self.listBox.setObjectName("listBox") self.verticalLayout.addWidget(self.listBox) self.horizontalLayout.addLayout(self.verticalLayout) self.verticalLayout_2 = QtGui.QVBoxLayout() self.verticalLayout_2.setObjectName("verticalLayout_2") self.addButton = QtGui.QPushButton(self.centralwidget) self.addButton.setObjectName("addButton") self.addButton.setText("Add") self.verticalLayout_2.addWidget(self.addButton) self.removeButton = QtGui.QPushButton(self.centralwidget) self.removeButton.setObjectName("removeButton") self.removeButton.setText("Remove") self.verticalLayout_2.addWidget(self.removeButton) self.clearButton = QtGui.QPushButton(self.centralwidget) self.clearButton.setObjectName("clearButton") self.clearButton.setText("Clear") self.loadButton = QtGui.QPushButton(self.centralwidget) self.loadButton.setObjectName("clearButton") self.loadButton.setText("Load File") self.verticalLayout_2.addWidget(self.loadButton) self.verticalLayout_2.addWidget(self.clearButton) spacerItem = QtGui.QSpacerItem(20,40,QtGui.QSizePolicy.Minimum,QtGui.QSizePolicy.Expanding) self.verticalLayout_2.addItem(spacerItem) self.horizontalLayout_2 = QtGui.QHBoxLayout() self.okButton = QtGui.QPushButton(self.centralwidget) self.okButton.setText("OK") self.cancelButton = QtGui.QPushButton(self.centralwidget) self.cancelButton.setText("Cancel") self.horizontalLayout_2.addWidget(self.okButton) self.horizontalLayout_2.addWidget(self.cancelButton) self.verticalLayout_2.addLayout(self.horizontalLayout_2) self.horizontalLayout.addLayout(self.verticalLayout_2) QMetaObject.connectSlotsByName(TestLayout) # connect buttons self.connect(self.addButton, QtCore.SIGNAL("clicked()"), self.addToList) self.connect(self.removeButton, QtCore.SIGNAL("clicked()"), self.removeFromList) self.connect(self.clearButton, QtCore.SIGNAL("clicked()"), self.clearList) self.connect(self.loadButton, QtCore.SIGNAL("clicked()"), self.loadListFile) self.connect(self.okButton, QtCore.SIGNAL("clicked()"), self.ListUpdate) self.connect(self.cancelButton, QtCore.SIGNAL("clicked()"), self.cancelListUpdate)
def doneCompletion(self): self.timer.stop() self.ui.popup.hide() self.ui.editor.setFocus() item = self.ui.popup.currentItem() if item != None: self.currentItem = self.ui.popup.currentItem().data(0, 0) self.ui.editor.setText(item.text(self.textplacetoeditor)) QMetaObject.invokeMethod(self.ui.editor, "returnPressed")
def setupUi (self, MainWindow): '''sets up the Maya UI. @param MainWindow ''' MainWindow.setObjectName ('MainWindow') MainWindow.resize (800, 1396) sizePolicy = QSizePolicy (QSizePolicy.Preferred, QSizePolicy.Preferred) sizePolicy.setHorizontalStretch (0) sizePolicy.setVerticalStretch (0) sizePolicy.setHeightForWidth(MainWindow.sizePolicy().hasHeightForWidth()) MainWindow.setSizePolicy(sizePolicy) font = QFont () font.setPointSize (11) MainWindow.setFont (font) MainWindow.setWindowTitle (QApplication.translate("MainWindow", "Location Tool", None, QApplication.UnicodeUTF8)) MainWindow.setTabShape (QTabWidget.Rounded) MainWindow.setDockOptions (QMainWindow.AllowTabbedDocks|QMainWindow.AnimatedDocks) self.scrollAreaWidgetContents_3 = QWidget (MainWindow) self.scrollAreaWidgetContents_3.setGeometry (QRect(10, 10, 900, 940)) self.scrollAreaWidgetContents_3.setObjectName ('scrollAreaWidgetContents_3') self._view = View0.View ("JADEview", self.graph_view, self.scene, self.scrollAreaWidgetContents_3) self._view.setObjectName ('JADEview') # real ui name self._view.graphicsView.setObjectName ('JADEInnerView') self.connect (self.scene, SIGNAL("selectionChanged()"), self._view.selectionChanged) self._view.wireViewItemsUp () self._view.getGraphicsView().setScene (self.scene) self._view.setToolboxCSSColorScheme ('background-color: rgb(68,68,68);color: rgb(200,200,200)') # this needs to be done since the toolbox's background didn't have a uniform colour otherwise. #self._view.setGraphicsViewCSSBackground () # the CSS background doesn't seem to work in Maya as there seems to be a problem with cleaning QGraphicsLineItems when they move, that doesn't happen when there's no CSS applied to the background. self.graphicsView = self._view.getGraphicsView () self.node_coords = QPoint (0,0) layout = QHBoxLayout (self.scrollAreaWidgetContents_3) layout.setContentsMargins (QMargins(0,0,0,0)); layout.addWidget (self._view) QMetaObject.connectSlotsByName (MainWindow) """ cmds.control('JADEInnerView', edit=True, ebg=True, bgc=[.5,.5,.9]) print cmds.control('JADEInnerView', query=True, p=True) """ # wiring the Maya Contextual pop-up Menus - yes, in Maya we've split the pop-up menu definition in three pop-up menus although only one will be present at any time. self.menu = cmds.popupMenu ('JADEmenu', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenu()', aob=True) self.menuAddOuts = cmds.popupMenu ('JADEmenuAddOuts', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddOuts()', aob=True, alt=True) self.menuAddIns = cmds.popupMenu ('JADEmenuAddIns', parent='JADEInnerView', button=3, pmc = 'ClientMaya.ui.ctxMenuAddIns()', aob=True, ctl=True) # this class property is used to keep track of the mouse position. self._mouse = QCursor # self._view's zoom slider (we need this to correct the bias added to sort the mouse position when the zoom changes - ONLY in Maya) self._zoom_slider = self._view.getZoomSlider()
def run(self): self.eventLoop = QEventLoop() self.eventLoop.processEvents() QObject.connect(self._call, SIGNAL("finished(QString)"), lambda str: self.eventLoop.quit()) QMetaObject.invokeMethod( self._call, "moveToAndInit", Qt.QueuedConnection, Q_ARG("PyQt_PyObject", QThread.currentThread())) self.eventLoop.processEvents() self.eventLoop.exec_()
def run(self): self.eventLoop = QEventLoop() self.eventLoop.processEvents() QObject.connect(self._call, SIGNAL("finished(QString)"), lambda str: self.eventLoop.quit()) QMetaObject.invokeMethod(self._call, "moveToAndInit", Qt.QueuedConnection, Q_ARG("PyQt_PyObject", QThread.currentThread())) self.eventLoop.processEvents() self.eventLoop.exec_()
def __init__(self): QMainWindow.__init__(self) self.setWindowTitle("Simple Web Browser") self.widget = QWidget(self) self.webview = QWebView() self.webview.load(QUrl("http://www.recursospython.com/")) self.layout = QHBoxLayout() self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) QMetaObject.connectSlotsByName(self)
def __init__(self, s): QDialog.__init__(self) self.setModal(True) self.resize(600, 400) self.setWindowTitle(self.tr('Unit test')) layout = QVBoxLayout() self.text = QTextEdit() self.text.setEnabled(True) self.text.setText(s) layout.addWidget(self.text) self.setLayout(layout) QMetaObject.connectSlotsByName(self)
def func(): try: QMetaObject.invokeMethod(self, "_on_start", Qt.QueuedConnection) if allow_partial_results: kwargs['should_break'] = should_break res = method(self, *args, on_progress=on_progress, **kwargs) except StopExecution: res = None QMetaObject.invokeMethod(self, "_on_result", Qt.QueuedConnection, Q_ARG(object, res)) self.running = False
def run(self): try: result = self.func(*(self.args), **(self.kwargs)) except Exception as e: logger.exception("deferToThread caught exception: %r", e) QMetaObject.invokeMethod(DeferCallThread.mainThreadStub, "_slot_errback", Qt.QueuedConnection, Q_ARG("PyQt_PyObject", self.done), Q_ARG("PyQt_PyObject", e)) else: QMetaObject.invokeMethod(DeferCallThread.mainThreadStub, "_slot_callback", Qt.QueuedConnection, Q_ARG("PyQt_PyObject", self.done), Q_ARG("PyQt_PyObject", result)) finally: del self.func, self.done, self.args, self.kwargs
def __init__(self, parent=None): super(ProxyPreferencesWidget, self).__init__(parent, Qt.Dialog) self.setObjectName('Dialog') self.resize(325, 142) self.setMinimumSize(QSize(325, 142)) self.setMaximumSize(QSize(325, 142)) self.formLayout = QFormLayout(self) self.formLayout.setObjectName('formLayout') self.proxyEnable = QCheckBox(self) self.proxyEnable.setObjectName('proxyEnable') self.proxyEnable.stateChanged.connect(self.enable_edit) self.formLayout.setWidget(0, QFormLayout.LabelRole, self.proxyEnable) self.proxyServer = QLineEdit(self) self.proxyServer.setObjectName('proxyServer') self.formLayout.setWidget(1, QFormLayout.FieldRole, self.proxyServer) self.proxyLogin = QLineEdit(self) self.proxyLogin.setObjectName('proxyLogin') self.formLayout.setWidget(2, QFormLayout.FieldRole, self.proxyLogin) #self.proxyPass = QLineEdit(self) plug_path = os.path.abspath(__file__) plug_path = os.path.dirname(plug_path) self.proxyPass = ButtonInLineEdit(self, plug_path + '/eye.svg') self.proxyPass.setObjectName('proxyPass') self.proxyPass.setEchoMode(QLineEdit.Password) self.formLayout.setWidget(3, QFormLayout.FieldRole, self.proxyPass) self.buttonBox = QDialogButtonBox(self) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.buttonBox.setObjectName('buttonBox') self.formLayout.setWidget(4, QFormLayout.FieldRole, self.buttonBox) self.label = QLabel(self) self.label.setObjectName('label') self.formLayout.setWidget(1, QFormLayout.LabelRole, self.label) self.label_2 = QLabel(self) self.label_2.setObjectName('label_2') self.formLayout.setWidget(2, QFormLayout.LabelRole, self.label_2) self.label_3 = QLabel(self) self.label_3.setObjectName('label_3') self.formLayout.setWidget(3, QFormLayout.LabelRole, self.label_3) self.setWindowTitle('Proxy preferences') self.proxyEnable.setText('Enable Proxy') self.label.setText('Proxy server:port') self.label_2.setText('Login') self.label_3.setText('Password') QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.save_settings) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.reject) QObject.connect(self.proxyPass.Button, SIGNAL('pressed()'), lambda: self.proxyPass.setEchoMode(QLineEdit.Normal)) QObject.connect(self.proxyPass.Button, SIGNAL('released()'), lambda: self.proxyPass.setEchoMode(QLineEdit.Password)) QMetaObject.connectSlotsByName(self)
def shutdown(self, wait=True): """ Shutdown the executor and free all resources. If `wait` is True then wait until all pending futures are executed or cancelled. """ if self._depot_thread is not None: QMetaObject.invokeMethod(self._depot_thread, "quit", Qt.AutoConnection) if wait: self._threadPool.waitForDone() if self._depot_thread: self._depot_thread.wait() self._depot_thread = None
def shutdown(self, wait=True): """ Shutdown the executor and free all resources. If `wait` is True then wait until all pending futures are executed or cancelled. """ if self._depot_thread is not None: QMetaObject.invokeMethod( self._depot_thread, "quit", Qt.AutoConnection) if wait: self._threadPool.waitForDone() if self._depot_thread: self._depot_thread.wait() self._depot_thread = None
def handleRequest(self): request = WebServerRequest(self) response = WebServerResponse(self) for server in servers: # verify which server this request is for if self.server == server.httpd: connectionType = Qt.BlockingQueuedConnection if QThread.currentThread() == server.thread(): connectionType = Qt.DirectConnection QMetaObject.invokeMethod(server, 'newRequest', connectionType, Q_ARG(WebServerRequest, request), Q_ARG(WebServerResponse, response)) break
def __init__(self): QMainWindow.__init__(self) self.setObjectName('EzSphinx') self.setWindowTitle('EzSphinx') # TODO: Use setuptools resources here pngpath = os.path.join(os.getcwd(), os.path.dirname(sys.argv[0]), 'images', 'ezsphinx.png') self._icon = QIcon(pngpath) self.setWindowIcon(self._icon) QApplication.instance().setWindowIcon(self._icon) QMetaObject.connectSlotsByName(self) self.config = EasyConfigParser() self._setup_ui() # load last user settings self._load_preferences()
def cardScanned(self, card): self.statusLabel.setText("Loading ...") userid = self.uf.read(card)[1] user = InternetClient.getUserDetails(userid) status = InternetClient.getUserStatus(userid, 0) statusDetails = None if status == "in": statusDetails = InternetClient.getUserStatus(userid, 1) QMetaObject.invokeMethod(self.parent, "startLogin", Qt.QueuedConnection, Q_ARG(QString, userid), Q_ARG(QString, user["realname"]), Q_ARG(QString, status), Q_ARG(QString, user["last_visit"])) self.statusLabel.setText("")
def __init__( self, title="Simple Web Browser", urlInit="file:///home/david/Documentos/CreadorDiagramas/miDiagrama.html" ): QMainWindow.__init__(self) self.setWindowTitle(title) self.widget = QWidget(self) # Widget para el navegador self.webview = QWebView() self.webview.load(QUrl(urlInit)) self.webview.urlChanged.connect(self.url_changed) # Ir hacia atrás self.back_button = QPushButton("<") self.back_button.clicked.connect(self.webview.back) # Ir hacia adelante self.forward_button = QPushButton(">") self.forward_button.clicked.connect(self.webview.forward) # Actualizar la página self.refresh_button = QPushButton("Actualizar") self.refresh_button.clicked.connect(self.webview.reload) # Barra de direcciones self.url_text = QLineEdit() # Cargar la página actual self.go_button = QPushButton("Ir") self.go_button.clicked.connect(self.url_set) self.toplayout = QHBoxLayout() self.toplayout.addWidget(self.back_button) self.toplayout.addWidget(self.forward_button) self.toplayout.addWidget(self.refresh_button) self.toplayout.addWidget(self.url_text) self.toplayout.addWidget(self.go_button) self.layout = QVBoxLayout() self.layout.addLayout(self.toplayout) self.layout.addWidget(self.webview) self.widget.setLayout(self.layout) self.setCentralWidget(self.widget) QMetaObject.connectSlotsByName(self)
def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(300, 270) self.centralwidget = QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8("centralwidget")) self.buttonSave = QPushButton(self.centralwidget) self.buttonSave.setGeometry(QRect(120, 235, 71, 32)) self.buttonSave.setObjectName(_fromUtf8("buttonSave")) self.inputFolder = QLineEdit(self.centralwidget) self.inputFolder.setGeometry(QRect(130, 10, 131, 23)) self.inputFolder.setObjectName(_fromUtf8("inputFolder")) self.buttonSelectFolder = QToolButton(self.centralwidget) self.buttonSelectFolder.setGeometry(QRect(263, 10, 27, 23)) self.buttonSelectFolder.setToolButtonStyle(Qt.ToolButtonIconOnly) self.buttonSelectFolder.setAutoRaise(False) self.buttonSelectFolder.setArrowType(Qt.NoArrow) self.buttonSelectFolder.setObjectName(_fromUtf8("buttonSelectFolder")) self.labelFolder = QLabel(self.centralwidget) self.labelFolder.setGeometry(QRect(10, 13, 101, 16)) self.labelFolder.setObjectName(_fromUtf8("labelFolder")) self.inputLogin = QLineEdit(self.centralwidget) self.inputLogin.setGeometry(QRect(130, 40, 161, 23)) self.inputLogin.setObjectName(_fromUtf8("inputLogin")) self.inputPassword = QLineEdit(self.centralwidget) self.inputPassword.setGeometry(QRect(130, 70, 161, 23)) self.inputPassword.setObjectName(_fromUtf8("inputPassword")) self.labelLogin = QLabel(self.centralwidget) self.labelLogin.setGeometry(QRect(10, 42, 62, 16)) self.labelLogin.setObjectName(_fromUtf8("labelLogin")) self.labelPassword = QLabel(self.centralwidget) self.labelPassword.setGeometry(QRect(10, 72, 62, 16)) self.labelPassword.setObjectName(_fromUtf8("labelPassword")) self.output = QPlainTextEdit(self.centralwidget) self.output.setEnabled(True) self.output.setGeometry(QRect(10, 100, 281, 131)) self.output.viewport().setProperty("cursor", QCursor(Qt.IBeamCursor)) self.output.setReadOnly(True) self.output.setObjectName(_fromUtf8("output")) font = QApplication.font() font.setPointSize(11) self.output.setFont(font) MainWindow.setCentralWidget(self.centralwidget) self.retranslateUi(MainWindow) self.connectSignals() QMetaObject.connectSlotsByName(MainWindow)
def setupUi(self): self.setObjectName("ReferencedTableEditor") self.gridLayout = QGridLayout(self) self.gridLayout.setVerticalSpacing(10) self.gridLayout.setObjectName("gridLayout") self.label_2 = QLabel(self) self.label_2.setMaximumSize(QSize(100, 16777215)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.cbo_source_field = QComboBox(self) self.cbo_source_field.setMinimumSize(QSize(0, 30)) self.cbo_source_field.setObjectName("cbo_source_field") self.gridLayout.addWidget(self.cbo_source_field, 2, 1, 1, 1) self.label = QLabel(self) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 2, 0, 1, 1) self.label_3 = QLabel(self) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) self.cbo_referencing_col = QComboBox(self) self.cbo_referencing_col.setMinimumSize(QSize(0, 30)) self.cbo_referencing_col.setObjectName("cbo_referencing_col") self.gridLayout.addWidget(self.cbo_referencing_col, 3, 1, 1, 1) self.cbo_ref_table = QComboBox(self) self.cbo_ref_table.setMinimumSize(QSize(0, 30)) self.cbo_ref_table.setObjectName("cbo_ref_table") self.gridLayout.addWidget(self.cbo_ref_table, 1, 1, 1, 1) self.label_2.setText( QApplication.translate("ReferencedTableEditor", "References")) self.label.setText( QApplication.translate("ReferencedTableEditor", "Data source field")) self.label_3.setText( QApplication.translate("ReferencedTableEditor", "Referencing")) self._current_profile = current_profile() self._current_profile_tables = [] if self._current_profile is not None: self._current_profile_tables = self._current_profile.table_names() #Connect signals QMetaObject.connectSlotsByName(self) self.cbo_ref_table.currentIndexChanged[str].connect( self._load_source_table_fields)
def setupUi(self): self.valueItems = {} self.dependentItems = {} self.resize(650, 450) self.buttonBox = QDialogButtonBox() self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.Ok) self.infoText = QTextEdit() numbers = self.getAvailableValuesOfType(ParameterNumber, OutputNumber) text = self.tr( 'You can refer to model values in your formula, using ' 'single-letter variables, as follows:\n', 'CalculatorModelerParametersDialog') ichar = 97 if numbers: for number in numbers: text += chr(ichar) + '->' + self.resolveValueDescription( number) + '\n' ichar += 1 else: text += self.tr('\n - No numerical variables are available.', 'CalculatorModelerParametersDialog') self.infoText.setText(text) self.infoText.setEnabled(False) self.formulaText = QLineEdit() if hasattr(self.formulaText, 'setPlaceholderText'): self.formulaText.setPlaceholderText( self.tr('[Enter your formula here]', 'CalculatorModelerParametersDialog')) if self._algName is not None: alg = self.model.algs[self._algName] self.formulaText.setText(alg.params[FORMULA]) self.setWindowTitle( self.tr('Calculator', 'CalculatorModelerParametersDialog')) self.verticalLayout = QVBoxLayout() self.verticalLayout.setSpacing(2) self.verticalLayout.setMargin(0) self.verticalLayout.addWidget(self.infoText) self.verticalLayout.addWidget(self.formulaText) self.verticalLayout.addWidget(self.buttonBox) self.setLayout(self.verticalLayout) QObject.connect(self.buttonBox, SIGNAL('accepted()'), self.okPressed) QObject.connect(self.buttonBox, SIGNAL('rejected()'), self.cancelPressed) QMetaObject.connectSlotsByName(self)
def fetchFiles(self, urls, renderContext): downloader = Downloader(None, self.maxConnections, self.cacheExpiry, self.userAgent) downloader.moveToThread(QgsApplication.instance().thread()) downloader.timer.moveToThread(QgsApplication.instance().thread()) self.logT("TileLayer.fetchFiles() starts") # create a QEventLoop object that belongs to the current worker thread eventLoop = QEventLoop() downloader.allRepliesFinished.connect(eventLoop.quit) if self.iface: # for download progress downloader.replyFinished.connect(self.networkReplyFinished) self.downloader = downloader # create a timer to watch whether rendering is stopped watchTimer = QTimer() watchTimer.timeout.connect(eventLoop.quit) # fetch files QMetaObject.invokeMethod(self.downloader, "fetchFilesAsync", Qt.QueuedConnection, Q_ARG(list, urls), Q_ARG(int, self.plugin.downloadTimeout)) # wait for the fetch to finish tick = 0 interval = 500 timeoutTick = self.plugin.downloadTimeout * 1000 / interval watchTimer.start(interval) while tick < timeoutTick: # run event loop for 0.5 seconds at maximum eventLoop.exec_() if downloader.unfinishedCount() == 0 or renderContext.renderingStopped(): break tick += 1 watchTimer.stop() if downloader.unfinishedCount() > 0: downloader.abort(False) if tick == timeoutTick: downloader.errorStatus = Downloader.TIMEOUT_ERROR self.log("fetchFiles(): timeout") # watchTimer.timeout.disconnect(eventLoop.quit) # downloader.allRepliesFinished.disconnect(eventLoop.quit) self.logT("TileLayer.fetchFiles() ends") return downloader.fetchedFiles
def __init__(self,parent=None): super(dialog, self).__init__(parent) self.setModal(True) self.setGeometry(100,100,600,400) self.ok=QPushButton(self) self.ok.move(200,350) self.ok.setText("ok") self.ok.setObjectName("ok_pushbutton") self.cancle = QPushButton(self) self.cancle.move(400,350) self.cancle.setText("cancle") self.cancle.setObjectName("cancle_pushbutton") QMetaObject.connectSlotsByName(self) #信号和槽 自动连接
def setupUi(self): self.setObjectName("ReferencedTableEditor") self.gridLayout = QGridLayout(self) self.gridLayout.setVerticalSpacing(10) self.gridLayout.setObjectName("gridLayout") self.label_2 = QLabel(self) self.label_2.setMaximumSize(QSize(100, 16777215)) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 1, 0, 1, 1) self.cbo_source_field = QComboBox(self) self.cbo_source_field.setMinimumSize(QSize(0, 30)) self.cbo_source_field.setObjectName("cbo_source_field") self.gridLayout.addWidget(self.cbo_source_field, 2, 1, 1, 1) self.label = QLabel(self) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 2, 0, 1, 1) self.label_3 = QLabel(self) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 3, 0, 1, 1) self.cbo_referencing_col = QComboBox(self) self.cbo_referencing_col.setMinimumSize(QSize(0, 30)) self.cbo_referencing_col.setObjectName("cbo_referencing_col") self.gridLayout.addWidget(self.cbo_referencing_col, 3, 1, 1, 1) self.cbo_ref_table = QComboBox(self) self.cbo_ref_table.setMinimumSize(QSize(0, 30)) self.cbo_ref_table.setObjectName("cbo_ref_table") self.gridLayout.addWidget(self.cbo_ref_table, 1, 1, 1, 1) self.label_2.setText(QApplication.translate("ReferencedTableEditor", "References")) self.label.setText(QApplication.translate("ReferencedTableEditor", "Data source field")) self.label_3.setText(QApplication.translate("ReferencedTableEditor", "Referencing")) self._current_profile = current_profile() self._current_profile_tables = [] if self._current_profile is not None: self._current_profile_tables = self._current_profile.table_names() #Connect signals QMetaObject.connectSlotsByName(self) self.cbo_ref_table.currentIndexChanged[str].connect(self._load_source_table_fields)
def setupUi(self, showprogress): showprogress.setObjectName("showprogress") showprogress.resize(335, 310) self.verticalLayout = QVBoxLayout(showprogress) self.verticalLayout.setObjectName("verticalLayout") self.barProgress = QProgressBar(showprogress) self.barProgress.setProperty("value", QVariant(0)) self.barProgress.setObjectName("barProgress") self.verticalLayout.addWidget(self.barProgress) self.infoText = QTextEdit(showprogress) palette = QPalette() brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Active, QPalette.Text, brush) brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Active, QPalette.Base, brush) brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Inactive, QPalette.Text, brush) brush = QBrush(QColor(0, 0, 0)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Inactive, QPalette.Base, brush) brush = QBrush(QColor(126, 125, 124)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Disabled, QPalette.Text, brush) brush = QBrush(QColor(255, 255, 255)) brush.setStyle(Qt.SolidPattern) palette.setBrush(QPalette.Disabled, QPalette.Base, brush) self.infoText.setPalette(palette) self.infoText.setObjectName("infoText") self.verticalLayout.addWidget(self.infoText) self.horizontalLayout = QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") spacerItem = QSpacerItem(40, 20, QSizePolicy.Expanding, QSizePolicy.Minimum) self.horizontalLayout.addItem(spacerItem) self.fermer = QPushButton(showprogress) self.fermer.setObjectName("fermer") self.horizontalLayout.addWidget(self.fermer) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(showprogress) QMetaObject.connectSlotsByName(showprogress)
def setupUi(self, dialog, hiddenTask=None): dialog.setObjectName("dialog") dialog.resize(300, 300) self.gridlayout = QGridLayout(dialog) self.gridlayout.setMargin(9) self.gridlayout.setSpacing(6) self.gridlayout.setObjectName("gridlayout") self.taskTreeWidget = TaskTree(mainWindow=dialog.parent(), makeActions=False, hiddenTask=hiddenTask) self.gridlayout.addWidget(self.taskTreeWidget, 0, 0, 1, 1) self.buttonBox = QDialogButtonBox(dialog) self.buttonBox.setOrientation(Qt.Horizontal) self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel | QDialogButtonBox.NoButton | QDialogButtonBox.Ok) self.buttonBox.setObjectName("buttonBox") self.gridlayout.addWidget(self.buttonBox, 1, 0, 1, 1) self.retranslateUi(dialog) self.buttonBox.accepted.connect(dialog.accept) self.buttonBox.rejected.connect(dialog.reject) QMetaObject.connectSlotsByName(dialog)
def __init__(self, ci, db, parent=None): #-------------------------------------------------------------------------------------------------------------- # INICIAR Y CONFIGURAR EL POPUP #-------------------------------------------------------------------------------------------------------------- # Crear y configurar los objetos del ui super(especialPopUp0, self).__init__(parent) self.setupUi(self) # Guardar identificador de cliente y referencia al manejador de la base de datos self.ci = ci self.db = db # Inicializar variables self.mutex = False self.mutex1 = False self.newIndex = False self.purchases = {} self.increases = {} self.currentPurchase = "Compra #1" self.currentIncrease = "Increase #1" # Configurar mensaje del popUp self.loadDetails() # Configurar resolucion del popUp self.setFixedSize(self.sizeHint()) self.setWindowFlags(dialogFlags) # Configurar tema self.stylePath = join(stylesPath, "especialPopUp0") self.setStyle(parent.theme) # Variable de control para saber cuando se hcae click sobre un botón self.clicked = False # Conectar los eventos mediante los nombres de los métodos QMetaObject.connectSlotsByName(self)
def addClusterPage (self, new_cluster_id): self.enableAllClusterPagesDeleteButton () # enable all the cluster page's delete buttons (as I can be bothered to go look for the one that got previously disabled) tmp_w = QWidget () tmp_l = QLabel (tmp_w) tmp_e = QLineEdit (tmp_w) tmp_b = QPushButton (tmp_w) self._cluster_page_list.append ([new_cluster_id, tmp_w, tmp_l, tmp_e, tmp_b]) tmp_w.setGeometry (QRect (0, 0, 131, 241)) tmp_w.setObjectName ('Cluster_' + str (new_cluster_id)) tmp_l.setGeometry (QRect (4, 6, 62, 16)) tmp_l.setFont (self.font) tmp_l.setObjectName ('label_' + str (new_cluster_id)) tmp_e.setGeometry (QRect (2, 20, 60, 16)) tmp_e.setObjectName ('groupLineEdit_' + str (new_cluster_id)) tmp_b.setGeometry (QRect (2, 50, 60, 16)) tmp_b.setFont (self.font) tmp_b.setObjectName ('pushButton_' + str (new_cluster_id)) self._toolBox.addItem (tmp_w, 'cluster_page_'+str(new_cluster_id)) self._toolBox.setItemText (self._toolBox.indexOf (tmp_w), QApplication.translate ('Form', 'C_'+str(new_cluster_id), None, QApplication.UnicodeUTF8)) tmp_l.setText (QApplication.translate ("Form", "name cluster", None, QApplication.UnicodeUTF8)) tmp_b.setText (QApplication.translate ("Form", "delete", None, QApplication.UnicodeUTF8)) self._toolBox.setCurrentIndex (new_cluster_id) QMetaObject.connectSlotsByName (self) # hook up the delete button (use a closure) receiver = lambda : self.removeCluster (new_cluster_id) self.connect (tmp_b, SIGNAL ("clicked()"), receiver) # connect the 'add cluster' button to the method generating new cluster pages. receiver2 = lambda value : self.updateClusterModelName (new_cluster_id, value) self.connect (tmp_e, SIGNAL ("textChanged(QString)"), receiver2)
def wrapper(obj, *args): # XXX: support kwargs? qargs = [Q_ARG(t, v) for t, v in zip(self.args, args)] invoke_args = [obj._instance, self.name] invoke_args.append(Qt.DirectConnection) rtype = self.returnType if rtype: invoke_args.append(Q_RETURN_ARG(rtype)) invoke_args.extend(qargs) try: result = QMetaObject.invokeMethod(*invoke_args) error_msg = str(qApp.property("MIKRO_EXCEPTION").toString()) if error_msg: # clear message qApp.setProperty("MIKRO_EXCEPTION", QVariant()) raise Error(error_msg) except RuntimeError, e: raise TypeError, \ "%s.%s(%r) call failed: %s" % (obj, self.name, args, e)
def setupUi (self, Form): font = QFont () font.setPointSize (9) font.setBold (False) font.setWeight (50) sizePolicy = QSizePolicy (QSizePolicy.Fixed, QSizePolicy.Fixed) sizePolicy.setHorizontalStretch (0) sizePolicy.setVerticalStretch (0) Form.setObjectName (_fromUtf8("Form")) Form.resize (971, 930) self.plainTextEdit = QPlainTextEdit (Form) self.plainTextEdit.setGeometry (QRect (740, 280, 221, 611)) self.plainTextEdit.setObjectName (_fromUtf8 ("plainTextEdit")) self.plainTextEdit.setFont (font) self.widget = OGLViewer (Form) self.widget.setUi_Form (self) self.widget.setGeometry (QRect (10, 10, 720, 450)) sizePolicy.setHeightForWidth (self.widget.sizePolicy().hasHeightForWidth()) self.widget.setSizePolicy (sizePolicy) self.widget.setObjectName (_fromUtf8 ("widget")) self.wireOGLViewerUp () self.wireEngineUp () self.label_view = QLabel (Form) self.label_view.setGeometry (QRect (10, 470, 720, 450)) sizePolicy.setHeightForWidth (self.label_view.sizePolicy().hasHeightForWidth()) self.label_view.setSizePolicy (sizePolicy) self.label_view.setObjectName (_fromUtf8 ("label_view")) self.initLabel () self.pixmap_item = self.label_view.setPixmap (QPixmap.fromImage (self.image)) # buttons definitions self.renderBtn = QPushButton (Form) self.pauseBtn = QPushButton (Form) self.stopBtn = QPushButton (Form) self.upBtn = QPushButton (Form) self.downBtn = QPushButton (Form) self.moreDownBtn = QPushButton (Form) self.moreUpBtn = QPushButton (Form) self.rightBtn = QPushButton (Form) self.moreRightBtn = QPushButton (Form) self.leftBtn = QPushButton (Form) self.furtherLeft = QPushButton (Form) self.grid_switch = QPushButton (Form) buttons_properties_list = [[self.renderBtn, True, QRect (740, 140, 61, 21), "render"], [self.pauseBtn, False, QRect (740, 120, 61, 21), "pause"], [self.stopBtn, False, QRect (740, 100, 61, 21), "stop"], [self.upBtn, False, QRect (820, 120, 21, 21), "one_row_up"], [self.downBtn, False, QRect (820, 140, 21, 21), "one_row_down"], [self.moreDownBtn, False, QRect (820, 160, 21, 21), "ten_rows_down"], [self.moreUpBtn, False, QRect (820, 100, 21, 21), "ten_rows_up"], [self.rightBtn, False, QRect (780, 180, 21, 21), "one_column_right"], [self.moreRightBtn, False, QRect (800, 180, 21, 21), "ten_columns_right"], [self.leftBtn, False, QRect (760, 180, 21, 21), "one_column_left"], [self.furtherLeft, False, QRect (740, 180, 21, 21), "ten_columns_left"], [self.grid_switch, False, QRect (870, 230, 91, 31), "grid_switch"]] for button in buttons_properties_list: button[0].setEnabled (button[1]) button[0].setGeometry (button[2]) button[0].setFont (font) button[0].setObjectName (_fromUtf8 (button[3])) # other UI elements self.progressBar = QProgressBar (Form) self.progressBar.setGeometry (QRect (740, 901, 221, 20)) self.progressBar.setProperty ("value", 0) self.progressBar.setObjectName (_fromUtf8("progressBar")) self.progressBar.setMinimum (0) self.progressBar.setMaximum (100) self.slider_label = QLabel (Form) self.slider_label.setGeometry (QRect(900, 260, 61, 16)) self.slider_label.setFont(font) self.slider_label.setObjectName (_fromUtf8("slider_label")) self.slider_label.setEnabled (True) self.arrowSizeSlider = QSlider (Form) self.arrowSizeSlider.setGeometry (QRect (740, 258, 151, 22)) self.arrowSizeSlider.setMinimum (2) self.arrowSizeSlider.setMaximum (40) self.arrowSizeSlider.setSingleStep (1) self.arrowSizeSlider.setProperty ("value", 4) self.arrowSizeSlider.setOrientation (Qt.Horizontal) self.arrowSizeSlider.setObjectName (_fromUtf8("arrowSizeSlider")) self.retranslateUi (Form) QMetaObject.connectSlotsByName (Form)
def call(*args): args = [Q_ARG(atype, arg) for atype, arg in zip(sig, args)] return QMetaObject.invokeMethod(obj, name, conntype, *args)
def update(f): QMetaObject.invokeMethod(self, "_update_info", Qt.QueuedConnection)
def setupUi(self, port): self.setObjectName("MainWindow") self.resize(600, 600) self.centralwidget = QWidget(self) p = self.centralwidget.palette() self.centralwidget.setAutoFillBackground(True) p.setColor(self.centralwidget.backgroundRole(), QColor(126, 135, 152)) self.centralwidget.setPalette(p) self.centralwidget.setObjectName("centralwidget") self.gridLayout = QGridLayout(self.centralwidget) self.gridLayout.setObjectName("gridLayout") self.setCentralWidget(self.centralwidget) self.menubar = QMenuBar(self) self.menubar.setGeometry(QRect(0, 0, 808, 25)) self.menubar.setObjectName("menubar") self.menuFile = QMenu(self.menubar) self.menuFile.setObjectName("menuFile") self.setMenuBar(self.menubar) self.statusbar = QStatusBar(self) self.statusbar.setObjectName("statusbar") self.setStatusBar(self.statusbar) self.actionQuit = QAction(self) self.actionQuit.setObjectName("actionQuit") self.menuFile.addSeparator() self.menuFile.addAction(self.actionQuit) self.menubar.addAction(self.menuFile.menuAction()) self.actionReset = QAction(self) self.actionReset.setObjectName("reset") self.menuFile.addSeparator() self.menuFile.addAction(self.actionReset) self.menubar.addAction(self.menuFile.menuAction()) # add other GUI objects self.graph_widget = GraphWidget(self.statusbar) self.gridLayout.addWidget(self.graph_widget, 1, 11, 10, 10) pixmap = QPixmap(':/images/cta-logo-mini.png') lbl = QLabel() lbl.setPixmap(pixmap) self.gridLayout.addWidget(lbl, 0, 0) p = self.graph_widget.palette() self.graph_widget.setAutoFillBackground(True) p.setColor(self.graph_widget.backgroundRole(), QColor(255, 255, 255)) # QColor(226, 235, 252)) self.graph_widget.setPalette(p) self.quitButton = QPushButton() # self.centralwidget) self.quitButton.setObjectName("quitButton") self.quitButton.setText( QApplication.translate("MainWindow", "Quit", None, QApplication.UnicodeUTF8)) self.gridLayout.addWidget(self.quitButton, 12, 0, 1, 1) self.info_label = InfoLabel(0, 4) self.info_label.setAutoFillBackground(True) self.gridLayout.addWidget(self.info_label, 1, 0, 1, 5) #self.info_label.setAlignment(PyQt4.Qt.AlignCenter); palette = QPalette() palette.setColor(self.info_label.backgroundRole(), Qt.lightGray) self.info_label.setPalette(palette) QObject.connect(self.quitButton, SIGNAL("clicked()"), self.stop) QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.stop) QMetaObject.connectSlotsByName(self) self.retranslateUi() QObject.connect(self.actionQuit, SIGNAL("triggered()"), self.close) QMetaObject.connectSlotsByName(self) # Create GuiConnexion for ZMQ comminucation with pipeline self.guiconnection = GuiConnexion(gui_port=port, statusBar=self.statusbar) self.guiconnection.message.connect(self.graph_widget.pipechange) self.guiconnection.message.connect(self.info_label.pipechange) self.guiconnection.reset_message.connect(self.graph_widget.reset) self.guiconnection.reset_message.connect(self.info_label.reset) self.guiconnection.mode_message.connect(self.info_label.mode_receive) QObject.connect(self.actionReset, SIGNAL("triggered()"), self.guiconnection.reset) QMetaObject.connectSlotsByName(self) # start the process self.guiconnection.start()