def _machine_context(self, action, ident): handler = self.doc.machine if action == 'new': dialog = self.makeGenericDialog(NewMachineDialog, (handler,)) dialog.connect(dialog, SIGNAL('okClicked()'), self.reset_manager) elif action == 'edit': dialog = self.makeGenericDialog(EditMachineDIalog, (handler, ident)) elif action == 'delete': msg = "Really delete this machine: %s?" % ident answer = KMessageBox.questionYesNo(self, msg) if answer == KMessageBox.Yes: #KMessageBox.information(self, "I'm supposed to be deleting %s" % ident) handler.delete_machine(ident) self.reset_manager() else: self._unhandled_action(action, 'machines') print "context is machine", action, ident
def __init__(self, parent, umlmachines, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() self.umlmachines = umlmachines self.proc = self.umlmachines.run_machine() self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Running Umlmachine %s' % self.umlmachines.current) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000)
def _connectSignalsWithSlots(self): """ Connects signals with the according slots. """ self.connect(self.dataTypeNameLineEdit, SIGNAL("textChanged(const QString&)"), self._controller.changeTitleSlot) self.connect(self.dataTypeSelectIconPushButton, SIGNAL("clicked()"), self._controller.selectIconSlot) self.connect(self.propertyTable, SIGNAL("valueChanged(int, int)"), self._controller.propertyTableValueChangedSlot) self.connect(self.newAttributePushButton, SIGNAL("clicked()"), self._controller.newAttributeSlot) self.connect(self.removeAttributePushButton, SIGNAL("clicked()"), self._controller.removeAttributeSlot) self.connect(self.savePushButton, SIGNAL("clicked()"), self._controller.saveSlot) self.connect(self.resetPushButton, SIGNAL("clicked()"), self._controller.resetSlot) self.connect(self.cancelPushButton, SIGNAL("clicked()"), self._controller.closeDialogSlot)
def _connect_signals(self): connect(self._widget.child('buttonOk'), SIGNAL('clicked()'), self._slot_ok_pressed) # grid connections connect(self._maj_colour_button, SIGNAL('clicked()'), self._slot_major_grid_colour) connect(self._min_colour_button, SIGNAL('clicked()'), self._slot_minor_grid_colour) connect(self._maj_x_enabled, SIGNAL('clicked()'), self._slot_enable_major_grid) connect(self._maj_y_enabled, SIGNAL('clicked()'), self._slot_enable_major_grid) connect(self._min_x_enabled, SIGNAL('clicked()'), self._slot_enable_minor_grid) connect(self._min_y_enabled, SIGNAL('clicked()'), self._slot_enable_minor_grid)
def _parent_context(self, action, ident): handler = self.doc.machine if action == 'select': dialog = self.makeGenericDialog(MachineParentDialog, (handler, )) dialog.connect(dialog, SIGNAL('okClicked()'), self.slotParentSelected) elif action == 'delete': if handler.relation.parents.has_children(ident): msg = "This machine has children.\n" msg += "Removing this parent may affect the children.\n" msg += "Do you wish to remove it anyway?" answer = KMessageBox.questionYesNo(self, msg) if answer == KMessageBox.Yes: handler.delete_parent() else: handler.delete_parent() self.resetView() else: self._unhandled_action(action, 'parent')
def __init__(self): QObject.__init__(self) self.sysTray = KMySystemTray() self.sysTray.setPixmap(self.sysTray.loadIcon("ksmarttray")) self.sysTray.show() self.process = KProcIO() self.state = KSmartTray.State.Waiting self.lastKnownStatus = "" self.blinkFlag = False self.updateFailed = False self.checkTimer = QTimer() self.blinkTimer = QTimer() QObject.connect(self.checkTimer, SIGNAL("timeout()"), self.checkUpgrades) QObject.connect(self.process, SIGNAL("processExited(KProcess *)"), self.processDone) QObject.connect(self, PYSIGNAL("foundNewUpgrades()"), self.startBlinking) QObject.connect(self, PYSIGNAL("foundNoUpgrades()"), self.stopBlinking) QObject.connect(self.sysTray, PYSIGNAL("mouseEntered()"), self.stopBlinking) QObject.connect(self.blinkTimer, SIGNAL("timeout()"), self.toggleBlink) QObject.connect(self.sysTray.checkAction, SIGNAL("activated()"), self.manualCheckUpgrades) QObject.connect(self.sysTray.startSmartAction, SIGNAL("activated()"), self.startSmart) QObject.connect(self.sysTray.stopAction, SIGNAL("activated()"), self.stopChecking) QObject.connect(self.sysTray, SIGNAL("quitSelected()"), KApplication.kApplication(), SLOT("quit()")) QObject.connect(self.sysTray, PYSIGNAL("activated()"), self.runUpgrades) self.checkTimer.start(5 * 60 * 1000) self.checkUpgrades()
def main(): """ Start function. """ application = QApplication(sys.argv) splashScreen = utils.showSplash("splash_datafinder_admin.png") splashScreen.show() repositoryManager = RepositoryManager() repositoryManager.load() adminMainWindow = AdminMain(repositoryManager) application.connect(application, SIGNAL("lastWindowClosed()"), application, SLOT("quit()")) application.setMainWidget(adminMainWindow) screen = QApplication.desktop().screenGeometry() adminMainWindow.move( QPoint(screen.center().x() - adminMainWindow.width() / 2, screen.center().y() - adminMainWindow.height() / 2)) adminMainWindow.show() splashScreen.close(True) adminMainWindow.fileConnectSlot() application.exec_loop()
def __init__(self, app, *args): KMainWindow.__init__(self, *args) self.app = app self.icons = KIconLoader() self._environ_types = ['default', 'current'] self._differ_types = ['trait', 'family'] self.conn = app.conn self.cfg = app.cfg self.cursor = StatementCursor(self.conn) self._suites = [x.suite for x in self.cursor.select(table='suites')] self.initActions() self.initMenus() self.initToolbar() self.listView = KListView(self) self.listView.setRootIsDecorated(True) self.listView.addColumn('widget') self.setCentralWidget(self.listView) self.refreshListView() self.setCaption('Main Menu') self.connect(self.listView, SIGNAL('selectionChanged()'), self.selectionChanged)
def SimpleButton(parent, title, handler, page=None, image=None): tabpage = parent.getPage(page) button = QPushButton(tabpage) if image: bi = QPixmap() bi.loadFromData(image, "PNG") button.setIconSet(QIconSet(bi)) w = bi.width() + 3 h = bi.height() + 3 if w < 32: w = 32 if h < 32: h = 32 button.setMaximumSize(QSize(w, h)) else: button.setText(title) QToolTip.add(button, title) parent.connect(button, SIGNAL("clicked()"), handler) button.show() p = ToolbarPlugin(parent) p.getWidget = lambda: button
def insertNewProfile(self): win = self._dialog profile = win.getRecordData()['name'] profile_list = self.profile.get_profile_list() if profile not in profile_list: skeleton = self.cfg.get('management_gui', 'template_profile') if skeleton in profile_list: self.profile.copy_profile(skeleton, profile) self.refreshListView() else: dlg = BaseRecordDialog(win, ['suite']) dlg.frame.text_label.setText('Select a suite for this profile') dlg.connect(dlg, SIGNAL('okClicked()'), self.insertNewProfilewithSuite) dlg.show() dlg.profile = profile win.suite_dialog = dlg KMessageBox.information(self, 'need to select suite here') # need to determine if skeleton exists KMessageBox.information(self, 'make profile %s' % profile) else: KMessageBox.error(self, 'Profile %s already exists.' % profile)
def __init__(self, parent, suite, name='RunnerWidget'): QWidget.__init__(self, parent, name) self.app = get_application_pointer() cfg = self.app.umlcfg basefile = make_base_filesystem(suite, '%s.base' % suite, cfg=cfg, size=300, mkfs='mke2fs') self.bootstrapper = UmlBootstrapper(suite, basefile, cfg=self.cfg) self._mainbox = QVBoxLayout(self, 5, 7) # add label self.mainlabel = QLabel(self) self.mainlabel.setText('Bootstrapping suite %s' % suite) self._mainbox.addWidget(self.mainlabel) # add stdout viewer logfile = self.umlmachines.stdout_logfile.name self.logbrowser = LogBrowser(self, logfile) self._mainbox.addWidget(self.logbrowser) self.timer = QTimer(self) self.connect(self.timer, SIGNAL('timeout()'), self.update_progress) self.timer.startTimer(1000)
def simulate(self): if self._timer is not None: self._timer.stop() self._timer = None if not self.running: self.running = 1 self.qApp.exit_loop() return self.runUntilCurrent() if self._crashCall is not None: self._crashCall.reset(0) # gah timeout = self.timeout() if timeout is None: timeout = 1.0 timeout = min(timeout, 0.1) * 1010 if self._timer is None: self._timer = QTimer() QObject.connect(self._timer, SIGNAL("timeout()"), self.simulate) self._timer.start(timeout, 1)
def __init__(self, wizardView, wizardController, pageType, dataStoreHandler, iconHandler): """ @see L{AbstractOptionController <datafinder.gui. DFDataStoreConfigurationWizard.AbstractOptionController.__init__>} """ AbstractOptionController.__init__(self, wizardView, wizardController, pageType) self._dataStoreHandler = dataStoreHandler self._iconHandler = iconHandler # init datastore ComboBox self.wizardView.datastoreTypeComboBox.clear() self.wizardView.datastoreTypeComboBox.insertItem(datastores.DEFAULT_STORE, 0) self.wizardView.datastoreTypeComboBox.insertItem(datastores.WEBDAV_STORE, 1) self.wizardView.datastoreTypeComboBox.insertItem(datastores.FTP_STORE, 2) self.wizardView.datastoreTypeComboBox.insertItem(datastores.FILE_STORE, 3) self.wizardView.datastoreTypeComboBox.insertItem(datastores.GRIDFTP_STORE, 4) self.wizardView.datastoreTypeComboBox.insertItem(datastores.OFFLINE_STORE, 5) self.wizardView.datastoreTypeComboBox.insertItem(datastores.TSM_CONNECTOR_STORE, 6) self.wizardView.datastoreTypeComboBox.insertItem(datastores.S3_STORE, 7) self.wizardView.datastoreTypeComboBox.insertItem(datastores.SUBVERSION_STORE, 8) # make owner button invisible self.wizardView.datastoreOwnerPushButton.hide() # set labels for error displaying self.errorMessageLabel = self.wizardView.errorMessageLabel0 self.errorMessagePixmapLabel = self.wizardView.errorMessagePixmapLabel0 # select initial DataStore icon and type self.wizardView.setDatastoreIcon(self.wizardController.datastore.iconName) self.wizardView.datastoreTypeComboBox.setCurrentText(self.wizardController.datastore.storeType) # connect form specific slots self.wizardView.connect(self.wizardView.selectIconPushButton, SIGNAL("clicked()"), self._iconChangedSlot) self.wizardView.connect(self.wizardView.datastoreTypeComboBox, SIGNAL("activated(const QString&)"), self._datastoreTypeChangedSlot) self.wizardView.connect(self.wizardView.datastoreNameLineEdit, SIGNAL("textChanged(const QString&)"), self._datastoreNameTextChangedSlot) self.wizardView.connect(self.wizardView.datastoreOwnerLineEdit, SIGNAL("textChanged(const QString&)"), self._storeOwnerTextChangedSlot) self.wizardView.connect(self.wizardView.datafinderUrlLineEdit, SIGNAL("textChanged(const QString&)"), self._datafinderUrlTextChangedSlot) self.wizardView.connect(self.wizardView.defaultDatastoreCheckBox, SIGNAL("stateChanged(int)"), self._storeDefaultStateChangedSlot)
def newFamily(self): win = NewFamilyDialog(self) win.frame.text_label.setText('Add a new family.') win.connect(win, SIGNAL('okClicked()'), self.insertNewFamily) win.show() self._new_family_dialog = win
def __init__(self, parent, handler): VboxDialog.__init__(self, parent, 'BaseMachineDialog') self.handler = handler self._lists = dict(mtypes=[], profiles=[], kernels=[], filesystems=[]) self.dbaction = None self.connect(self, SIGNAL('okClicked()'), self.slotOkClicked)
def __init__(self): self.workers = {} self.checkTimer = QTimer() self.checkTimer.connect(self.checkTimer, SIGNAL("timeout()"), self.check) self.checkTimer.start(500)
def initContextMenu(self, context): """ Initiates the popup menu depending on the context and adds appropriate menu items. """ #ACTION TO ARRANGE THE ICONS IN A LINE arrangeIcons01Action = QAction("Lines", QKeySequence(), self, "arrangeIcons01Actions") arrangeIcons01Action.setIconSet(QIconSet()) self.connect(arrangeIcons01Action, SIGNAL("activated()"), self.parent().arrangeIconsInLines) #ACTION TO ARRANGE THE ICONS IN A CIRCLE arrangeIcons02Action = QAction("Circle", QKeySequence(), self, "arrangeIcons02Actions") arrangeIcons02Action.setIconSet(QIconSet()) self.connect(arrangeIcons02Action, SIGNAL("activated()"), self.parent().arrangeIconsInCircle) #SUBMENU TO CHOOSE THE WAY OF ARRANGEMENT #---------------------------------------- subMenu01 = QPopupMenu(self, "Arrange Icons") arrangeIcons01Action.addTo(subMenu01) arrangeIcons02Action.addTo(subMenu01) #ACTION TO UPDATE THE SCREEN updateCanvasViewAction = QAction("Update Screen", QKeySequence(), self, "updateCanvasViewAction") updateCanvasViewAction.setIconSet(QIconSet()) self.connect(updateCanvasViewAction, SIGNAL("activated()"), self.parent().updateCanvasView) #ACTION TO ADD A NEW DATATYPE newDataTypeAction = QAction("New Data Type...", QKeySequence(), self, "newDataTypeAction") newDataTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("newDataType16.png"))) self.connect(newDataTypeAction, SIGNAL("activated()"), self.myFrame.addDataTypeSlot) #ACTION TO ADD A NEW RELATIONTYPE newRelationTypeAction = QAction("New Relation Type...", QKeySequence(), self, "newRelationTypeAction") newRelationTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("newRelationType16.png"))) self.connect(newRelationTypeAction, SIGNAL("activated()"), self.myFrame.addRelationTypeSlot) #ACTION TO EDIT THE MARKED DATATYPE editDataTypeAction = QAction("Edit Data Type...", QKeySequence(), self, "editDataTypeAction") editDataTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("edit16.png"))) #ACTION TO EDIT THE MARKED RELATIONTYPE editRelationTypeAction = QAction("Edit Relation Type...", QKeySequence(), self, "editRelationTypeAction") editRelationTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("edit16.png"))) #ACTION TO REMOVE THE MARKED ICON FROM SCREEN removeIconAction = QAction("Remove Icon", QKeySequence(), self, "removeIconAction") removeIconAction.setIconSet( QIconSet(QPixmap.fromMimeSource("delete16.png"))) self.connect(removeIconAction, SIGNAL("activated()"), self.parent().removeIcon) #ACTION TO DELETE THE MARKED DATATYPEICON deleteDataTypeAction = QAction("Delete Data Type", QKeySequence(), self, "deleteDataTypeAction") deleteDataTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("delete16.png"))) self.connect(deleteDataTypeAction, SIGNAL("activated()"), self.myFrame.deleteSelectedDataType) #ACTION TO DELETE THE MARKED RELATIONTYPE deleteRelationTypeAction = QAction("Delete Relation Type", QKeySequence(), self, "deleteRelationTypeAction") deleteRelationTypeAction.setIconSet( QIconSet(QPixmap.fromMimeSource("delete16.png"))) self.connect(deleteRelationTypeAction, SIGNAL("activated()"), self.myFrame.deleteSelectedRelationType) #CONTEXT-MENU IF NOTHING IS MARKED if context == 0: newDataTypeAction.addTo(self) newRelationTypeAction.addTo(self) self.insertSeparator() self.insertItem("Arrange Icons...", subMenu01) updateCanvasViewAction.addTo(self) else: #CONTEXT-MENU IF A DATATYPE IS MARKED if context.iconType == 1: dataTypeController = data_type_dialog.DataTypeController( self.myFrame, context.iconLabel, self.myFrame.repositoryConfiguration) self.connect(editDataTypeAction, SIGNAL("activated()"), dataTypeController.show) editDataTypeAction.addTo(self) deleteDataTypeAction.addTo(self) self.insertSeparator() newDataTypeAction.addTo(self) newRelationTypeAction.addTo(self) self.insertSeparator() removeIconAction.addTo(self) self.insertItem("Arrange Icons...", subMenu01) updateCanvasViewAction.addTo(self) #CONTEXT-MENU IF A RELATIONTYPE IS MARKED if context.iconType == 2: relationTypeController = relation_type_dialog.RelationTypeController( self.myFrame, context.iconLabel, self.myFrame.repositoryConfiguration) self.connect(editRelationTypeAction, SIGNAL("activated()"), relationTypeController.show) editRelationTypeAction.addTo(self) deleteRelationTypeAction.addTo(self) self.insertSeparator() newDataTypeAction.addTo(self) newRelationTypeAction.addTo(self) self.insertSeparator() removeIconAction.addTo(self) self.insertItem("Arrange Icons...", subMenu01) updateCanvasViewAction.addTo(self)
# girdiyi gönder. ret = self.server.addEntry(username, password, str(self.filename), str(text.utf8()), self.inEdit) if not ret: QMessageBox.critical(self, "HATA", u"Girdi yayınlanamadı!") else: QMessageBox.information(self, "Bitti", u"Girdi başarı ile yayınlandı!") self._fillEntryList() # yayınladıktan sonra eğer içindeysek, EditMode'dan # çıkalım. Ve metin girişini temizleyelim. if self.inEdit: self.setEditMode(False) self.w.entryText.clear() def slotQuit(self): self.close() if __name__ == "__main__": app = QApplication(sys.argv) app.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()")) win = BlogWin() win.show() app.exec_loop()
def slotNew(self): win = NewTraitVariableDialog(self) win.show() win.connect(win, SIGNAL('okClicked()'), self.newVariableSelected) self._dialog = win
def __init__(self, parentFrame, dataStoreHandler, iconHandler, datastore=None): """ Constructor. """ self.parent = parentFrame self._dataStoreHandler = dataStoreHandler # create main view self.wizardView = view.DataStoreConfigurationWizardView(parentFrame) # init model if not datastore is None: self.datastore = datastore else: self.datastore = self._dataStoreHandler.createDataStore() # add control logic of the displayed forms self.lastPageTitle = standardOptionsPage self.currentFormHandler = default.base_option_controller.BaseOptionController( self.wizardView, self, standardOptionsPage, dataStoreHandler, iconHandler) self.formControllerDict = { standardOptionsPage: { _defaultForAllDataStores: self.currentFormHandler }, storageOptionsPage: { datastores.OFFLINE_STORE: offline.storage_option_controller.StorageOptionController( self.wizardView, self, storageOptionsPage), datastores.TSM_CONNECTOR_STORE: tsm.storage_option_controller.StorageOptionController( self.wizardView, self, storageOptionsPage), _defaultForAllDataStores: default.storage_option_controller.StorageOptionController( self.wizardView, self, storageOptionsPage) }, securityOptionsPage: { datastores.GRIDFTP_STORE: gridftp.security_option_controller.SecurityOptionController( self.wizardView, self, securityOptionsPage), }, authenticationOptionsPage: { datastores.FTP_STORE: ftp.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage), datastores.WEBDAV_STORE: webdav.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage), datastores.TSM_CONNECTOR_STORE: tsm.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage), datastores.S3_STORE: s3.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage), datastores.SUBVERSION_STORE: webdav.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage), _defaultForAllDataStores: default.authentication_option_controller. AuthenticationOptionController(self.wizardView, self, authenticationOptionsPage) }, performanceOptionsPage: { datastores.GRIDFTP_STORE: gridftp.performance_option_controller. PerformanceOptionController(self.wizardView, self, performanceOptionsPage) } } # show wizard self.wizardView.setCaption( wizardCaptionTemplate % (self.datastore.storeType, self.datastore.name)) self.wizardView.show() self.wizardView.adjustSize() self.currentFormHandler.showModelPart() self.setPageSequence() # connect slots self.wizardView.connect(self.wizardView, SIGNAL("selected(const QString&)"), self._wizardPageChangedSlot) self.wizardView.connect(self.wizardView.finishButton(), SIGNAL("clicked()"), self._finishedSlot)
def __init__(self): # Connect ourselves to the "appStarted()" signal emitted by Scribus. # Ask PyQt to run the self.gotSignal method when the signal is emitted. self.connect(qt.qApp, SIGNAL("appStarted()"), self.gotSignal)
def slotChangeSuite(self): print 'ChangeSuite' win = SuiteSelector(self.app, self) win.connect(win, SIGNAL('okClicked()'), self.set_suite) self._suitedialog = win
def __init__(self, app, parent, profile): self.profile = Profile(app.conn) self.profile.set_profile(profile) BaseAssigner.__init__(self, app, parent, name='TraitAssigner', udbuttons=True) self.connect(self, SIGNAL('okClicked()'), self.slotLaughAtMe)
def newFamily(self): dialog = SimpleRecordDialog(self, ['family']) dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewFamily) self._dialog = dialog
def __init__(self, parent=None, name=None): OptionsDialogUI.__init__(self, parent, name) self.connect(self.pbOk, SIGNAL("clicked()"), self, SLOT("accept()")) self.connect(self.pbCancel, SIGNAL("clicked()"), self, SLOT("reject()"))
def _connect_destroy_dialog(self, dialog): dialog.connect(dialog, SIGNAL('cancelClicked()'), self._destroy_dialog) dialog.connect(dialog, SIGNAL('closeClicked()'), self._destroy_dialog)
def makeNewRecordDialog(self, context, fields, message): dialog = self.makeGenericDialog(BaseRecordDialog, (fields, )) dialog.context = context dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewRecord) dialog.frame.setText(message)
def selectSystemTarballDialog(self): win = KFileDialog('.', '', self, 'SystemTarball', True) win.connect(win, SIGNAL('okClicked()'), self.fileSelected) win.show() self._dialog = win
def newProfile(self): dialog = SimpleRecordDialog(self, ['profile']) dialog.connect(dialog, SIGNAL('okClicked()'), self.insertNewProfile) self._dialog = dialog
def __init__(self, parent, handler): VboxDialog.__init__(self, parent, 'BaseMachineDialog') self.handler = handler self.dbaction = None self.connect(self, SIGNAL('okClicked()'), self.slotOkClicked)