def OnActionStart(self, event): handler = rt.RichTextHTMLHandler() handler.SetFlags(rt.RICHTEXT_HANDLER_SAVE_IMAGES_TO_BASE64) handler.SetFontSizeMapping([7,9,11,12,14,22,100]) import cStringIO stream = cStringIO.StringIO() if not handler.SaveStream(self.richTextPanel.rtc.GetBuffer(), stream): return htmldata = stream.getvalue() text = content.mime_message(htmldata, "hello hello this is a test", "this is a test", "*****@*****.**", "*****@*****.**").as_string() with open('email-example.eml', 'w') as f: f.write(text) #start send listctrl = self.list_ctrl _count = listctrl.GetItemCount() _host = config.read_config(config.HOST) _port = config.read_config(config.PORT) _user = config.read_config(config.ACCOUNT_NAME) _password = config.read_config(config.PASSWORD) _from = config.read_config(config.FROM) sender = Sender(_host, _port) sender.login(_user, _password) for i in range(_count): sender.send(_from, listctrl.GetItem(i, 1).GetText(), text)
def GetConfigPanel(self, parent): """Get the configuration panel for this plugin @param parent: parent window for the panel @return: wxPanel """ return ConfigDialog.ConfigNotebook(parent, wx.ID_ANY, ConfigDialog.ConfigData())
def OnActionSetting(self, event): dlg = config.ConfigDialog(parent=self, id=-1, title="Account Setting", style=wx.DEFAULT_DIALOG_STYLE | \ wx.RESIZE_BORDER) val = dlg.ShowModal() if val == wx.ID_OK: config.save_or_update_config(dlg.form_fields_to_dict()) dlg.Destroy()
def osd(self): global ProfileName, Host, portValue, keepValue, clientids, user, password, visionValue, cleanssionValue, napsBooL, pascheck dialog = ConfigDialog(self) result = dialog.exec_() for x in range(len(childlist)): childlist.remove(childlist[0]) if result: ProfileName, Host, portValue, keepValue, clientids, user, password, visionValue, cleanssionValue, napsBooL, pascheck = dialog.getsetdata( ) print ProfileName, Host, portValue, keepValue, clientids, user, password, visionValue, cleanssionValue, napsBooL, pascheck self.nameEdit.setText(ProfileName) dialog.destroy()
def __init__(self, parent): super(RepoModBox, self).__init__(parent) # Attributes self._list = RepoModList(self) self._config = ConfigDialog.ConfigData() # Singleton Config Obj self._crepo = 0 self._ctrl = ScCommand.SourceController(self) self._repos = self.FindRepos(self._config['projects'].keys()) self._repo_ch = None self._commit = None # Created in __DoLayout self._refresh = None self._update = None self._revert = None # Setup self.__DoLayout() # Event Handlers self.Bind(wx.EVT_BUTTON, lambda evt: self.DoCommit(), self._commit) self.Bind(wx.EVT_BUTTON, lambda evt: self.DoUpdate(), self._update) self.Bind(wx.EVT_BUTTON, lambda evt: self.DoStatusRefresh(), self._refresh) self.Bind(wx.EVT_BUTTON, lambda evt: self.DoRevert(), self._revert) self.Bind(wx.EVT_CHOICE, self.OnChoice, id=ID_REPO_CHOICE) self.Bind(wx.EVT_WINDOW_DESTROY, self.OnDestroy, self) # self.Bind(wx.EVT_UPDATE_UI, self.OnUpdateUI) # Handlers for projects messages sent over editra message bus ed_msg.Subscribe(self.OnProjectAdded, ConfigDialog.MSG_PROJ_ADDED) ed_msg.Subscribe(self.OnProjectRemoved, ConfigDialog.MSG_PROJ_REMOVED) # Do a refresh when first shown wx.CallLater(500, self.DoStatusRefresh)
def showConfigDialog(self): configDialog = ConfigDialog(self, self.config) configDialog.setModal(True) configDialog.show() if configDialog.result() == 0: self.mainFileBrowser.setRootPath(self.config.rootpath) self.svn.initSVNList()
def init(self): self.setHasConfigurationInterface(True) self.configDialog = ConfigDialog(self) self.configDialog.configurationChanged.connect(self.setupUi) self.passwordDialog = PasswordDialog(self.configDialog) # set up layout and widgets self.setupUi()
def ConfigDialog(self, event=None): dlg = ConfigDialog.ConfigDialog( self, -1, "Configuration", size=(350, 200), #style = wxCAPTION | wxSYSTEM_MENU | wxTHICK_FRAME style=wx.DEFAULT_DIALOG_STYLE) dlg.CenterOnScreen() # this does not return until the dialog is closed. val = dlg.ShowModal() dlg.Destroy()
def init(self): # Konfig-Dilog einrichten self.setHasConfigurationInterface(True) self.configDialog = ConfigDialog(self) QObject.connect(self.configDialog, SIGNAL('configurationChanged()'), self, SLOT('setupServicesAndWidgets()')) # Benutzeroberfläche einrichten self.setupAppletUi() if self.formFactor() == Plasma.Planar else self.setupPopupUi() # SignalMapper für die Buttons (Icons) einrichten self.iconMapper = QSignalMapper() QObject.connect(self.iconMapper, SIGNAL('mapped(QObject*)'), self, SLOT('iconClicked(QObject*)')) # Widgets im Main-Layout erzeugen, Timer starten self.setupServicesAndWidgets()
def OnConfigEdit(self, event): dlg = ConfigDialog(self, -1, "Configuration", self.dm) if dlg.ShowModal() == wx.ID_OK: self.dm.SaveToConfig() pass
class ServiceMonitor(Applet): def __init__(self, parent, args=None): Applet.__init__(self, parent) self.widgets = {} ##< [dict] Place for all widgets, so they can be addressed nicely. self.mainLayout = None ##< [QLayout] The layout containing all the widgets. def init(self): self.setHasConfigurationInterface(True) self.configDialog = ConfigDialog(self) self.configDialog.configurationChanged.connect(self.setupUi) self.passwordDialog = PasswordDialog(self.configDialog) # set up layout and widgets self.setupUi() ## Sets up all widgets in a popup which can be opened when clicking the applet. def setupUi(self): # remove old contents on successive calls deleteContentsRecursively(self.applet.layout()) deleteContentsRecursively(self.mainLayout) # determine mode if self.formFactor() == Plasma.Planar: self.mode = 'desktop' elif self.configDialog.panelBehavior() == 0: self.mode = 'icons' else: self.mode = 'popup' if self.mode == 'popup': # QGraphicsView initialisieren, in das alles gezeichnet wird self.scene = QGraphicsScene() self.view = QGraphicsView() self.view.setScene(self.scene) self.view.setFrameStyle(QFrame.NoFrame) self.view.setStyleSheet('background-color: transparent;') self.view.setAlignment(Qt.AlignHCenter | Qt.AlignTop) self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) # Layout-Container-Widget erzeugen und in die Szene einfügen self.container = QGraphicsWidget() self.mainLayout = QGraphicsGridLayout() self.container.setLayout(self.mainLayout) self.scene.addItem(self.container) self.mainLayout.setPreferredWidth(270) # Popup erzeugen self.popup = Plasma.Dialog() self.popup.setWindowFlags(Qt.Popup) self.popupLayout = QVBoxLayout() self.popup.setLayout(self.popupLayout) self.popupLayout.addWidget(self.view) self.popup.resize(250, 300) # Im Applet ein Icon anzeigen self.icon = Plasma.IconWidget(KIcon(":/panel-icon.png"), "") self.iconLayout = QGraphicsLinearLayout() self.iconLayout.addItem(self.icon) self.setAspectRatioMode(Plasma.ConstrainedSquare) self.applet.setLayout(self.iconLayout) self.icon.clicked.connect(self.togglePopup) elif self.mode in ['desktop', 'icons']: # Set up all widgets directly in the main applet. self.verticalLayout = QGraphicsLinearLayout(Qt.Vertical) self.applet.setLayout(self.verticalLayout) self.mainLayout = QGraphicsGridLayout() self.verticalLayout.addItem(self.mainLayout) self.verticalLayout.addStretch(1) self.applet.setAspectRatioMode(Plasma.IgnoreAspectRatio) # this seems to be necessary to avoid display bugs QTimer.singleShot(0, self.mainLayout.invalidate) activeServices = self.configDialog.activeServices() # Falls Services eingerichtet: Service-Widgets anzeigen if activeServices: for i, service in enumerate(activeServices): nameLabel = Plasma.Label() statusIcon = Plasma.IconWidget('') self.widgets[service.id] = { 'name': nameLabel, 'status': statusIcon } nameLabel.setText(u'<strong>%s</strong>' % service.name) nameLabel.nativeWidget().setWordWrap(False) statusIcon.setMinimumSize(22, 22) statusIcon.setMaximumSize(22, 22) nameLabel.setMinimumHeight(22) nameLabel.setMaximumHeight(22) self.refreshStateIcon(service) if self.mode == 'icons' and self.formFactor() == Plasma.Vertical: self.mainLayout.addItem(statusIcon, i, 0) elif self.mode == 'icons' and self.formFactor() == Plasma.Horizontal: self.mainLayout.addItem(statusIcon, 0, i) else: self.mainLayout.addItem(statusIcon, i, 0) self.mainLayout.addItem(nameLabel, i, 1) statusIcon.clicked.connect(partial(self.iconClicked, service)) # Falls keine Services eingerichtet: Einleitungstext anzeigen if not activeServices: self.widgets['intro'] = Plasma.Label() if self.mode != 'icons': self.widgets['intro'].setText(self.tr('<b>Thank you for downloading<br/>Service Monitor!</b><br/><br/>Right click to open the<br/>settings dialog.')) else: self.widgets['intro'].setText(self.tr('Right click to add services.')) self.widgets['intro'].setMinimumWidth(180) self.widgets['intro'].setAlignment(Qt.AlignHCenter | Qt.AlignVCenter) self.mainLayout.addItem(self.widgets['intro'], 0, 0) # in icons mode, squeeze as much as possible if self.mode == 'icons' and self.formFactor() == Plasma.Horizontal: self.mainLayout.setMaximumWidth(self.mainLayout.minimumWidth()) elif self.mode == 'icons' and self.formFactor() == Plasma.Vertical: self.mainLayout.setMaximumHeight(self.mainLayout.minimumHeight()) # Hier ist das Layout eingerichtet - aktivieren self.mainLayout.activate() # Scrollbarer Bereich verkleinert sich nicht automatisch im Popup, also von Hand if hasattr(self, 'popup'): self.container.adjustSize() self.scene.setSceneRect(self.container.geometry()) # Alle Polling-Prozesse anhalten und alte Connections trennen for service in self.configDialog.allServices(): service.setPolling(False) try: service.runningStateChanged.disconnect() except: pass # Aktive Prozesse neu einrichten und Polling starten interval = self.configDialog.pollingInterval() sleepTime = self.configDialog.sleepTime() for service in activeServices: service.runningStateChanged.connect(partial(self.refreshStateIcon, service)) service.wrongPassword[str].connect(partial(self.askPasswordAndRetry, service)) service.setSleepTime(sleepTime) service.setErrorReporting(not self.configDialog.suppressStdout()) service.setPolling(True, interval) ## Triggered on wrongPassword signal. Retries the last command. def askPasswordAndRetry(self, service): try: self.passwordDialog.newPasswordAvailable.disconnect() except: pass # if no slots are connected self.passwordDialog.setWindowTitle(service.name) self.passwordDialog.setCommandInfo(getattr(service, service.lastCommand())) self.passwordDialog.focusPasswordField() self.passwordDialog.setVisible(True) def retry(pw): self.passwordDialog.setVisible(False) QTimer.singleShot(0, partial(service.retryLastCommand, pw)) self.passwordDialog.newPasswordAvailable[QString].connect(retry) ## Open the config dialog; called by plasma. def showConfigurationInterface(self): self.configDialog.show() ## Starts or stops a service corresponding to the icon clicked. def iconClicked(self, service): if service.state[0] == 'missing': QMessageBox.warning(None, self.tr("Error"), self.tr('Service "%1" not installed. Aborting.').arg(service.id)) return if service.state[1] in ['running', 'starting']: command = "stopcommand" if service.state[1] in ['stopped', 'stopping']: command = "startcommand" service.execute(command, 'requested', self.passwordDialog.password()) ## Updates the icon corresponding to the service argument. def refreshStateIcon(self, service, reason = ''): icon = self.configDialog.runningStateIndicator(service) self.widgets[service.id]['status'].setIcon(icon) self.widgets[service.id]['status'].setToolTip("%s\nStatus: %s" % (service.name, service.state[1])) # send a KNotify notification if the change wasn't issued by the user if self.configDialog.useKNotify() and service.state[1] in ["running", "stopped"] and reason == 'polling': if service.state[1] == "running": message = self.tr("%1 is now running.").arg(service.name) else: message = self.tr("%1 has been stopped.").arg(service.name) self.knotify(icon, message) ## The call to knotify must be made from an external script, because python allows no self-connections def knotify(self, icon, message): byteArray = QByteArray() buffer = QBuffer(byteArray) icon.pixmap(QSize(32, 32)).toImage().rgbSwapped().save(buffer, "PNG") # KNotify seems to expect a BGR file tmp = file('icon.png', 'w') tmp.write(byteArray.data()) tmp.close() self.knotifyProcess = KProcess() self.knotifyProcess.setProgram(QStringList() << "/usr/bin/python" << ("%s/KNotify.py" % codedir) << message) self.knotifyProcess.start() ## Shows/hides popup dialog. @pyqtSlot() def togglePopup(self): if self.popup.isVisible(): self.popup.animatedHide(Plasma.Direction(0)) else: self.popup.move(self.popupPosition(self.popup.sizeHint())) self.popup.animatedShow(Plasma.Direction(0))
class ServiceMonitor(Applet): def __init__(self, parent, args=None): Applet.__init__(self, parent) ## [dict] Place for all widgets, so they can be addressed nicely. self.widgets = {} ## [QSignalMapper] Maps every QIcon to its corresponding service. self.iconMapper = None ## [QLayout] The layout containing all the widgets. self.mainLayout = None def init(self): # Konfig-Dilog einrichten self.setHasConfigurationInterface(True) self.configDialog = ConfigDialog(self) QObject.connect(self.configDialog, SIGNAL('configurationChanged()'), self, SLOT('setupServicesAndWidgets()')) # Benutzeroberfläche einrichten self.setupAppletUi() if self.formFactor() == Plasma.Planar else self.setupPopupUi() # SignalMapper für die Buttons (Icons) einrichten self.iconMapper = QSignalMapper() QObject.connect(self.iconMapper, SIGNAL('mapped(QObject*)'), self, SLOT('iconClicked(QObject*)')) # Widgets im Main-Layout erzeugen, Timer starten self.setupServicesAndWidgets() ## Sets up all widgets in a popup which can be opened when clicking the applet. def setupPopupUi(self): # QGraphicsView initialisieren, in das alles gezeichnet wird self.scene = QGraphicsScene() self.view = QGraphicsView() self.view.setScene(self.scene) self.view.setFrameStyle(QFrame.NoFrame) self.view.setStyleSheet('background-color: transparent;') self.view.setAlignment(Qt.AlignHCenter | Qt.AlignTop) self.view.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.view.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) # Layout-Container-Widget erzeugen und in die Szene einfügen self.container = QGraphicsWidget() self.mainLayout = QGraphicsGridLayout() self.container.setLayout(self.mainLayout) self.scene.addItem(self.container) self.mainLayout.setPreferredWidth(270) # Popup erzeugen self.popup = Plasma.Dialog() self.popup.setWindowFlags(Qt.Popup) self.popupLayout = QVBoxLayout() self.popup.setLayout(self.popupLayout) self.popupLayout.addWidget(self.view) self.popup.resize(250, 300) # Im Applet ein Icon anzeigen self.icon = Plasma.IconWidget(KIcon(":/panel-icon.png"), "") self.iconLayout = QGraphicsLinearLayout() self.iconLayout.addItem(self.icon) self.setAspectRatioMode(Plasma.ConstrainedSquare) self.applet.setLayout(self.iconLayout) QObject.connect(self.icon, SIGNAL("clicked()"), self, SLOT('togglePopup()')) ## Sets up all widgets directly in the main applet. def setupAppletUi(self): self.verticalLayout = QGraphicsLinearLayout(Qt.Vertical) self.setLayout(self.verticalLayout) self.mainLayout = QGraphicsGridLayout() self.verticalLayout.addItem(self.mainLayout) self.verticalLayout.addStretch(1) self.applet.setAspectRatioMode(Plasma.IgnoreAspectRatio) ## Open the config dialog; called by plasma. def showConfigurationInterface(self): self.configDialog.show() ## [slot] Create all widgets inside the main layout and set up the services for monitoring. # This function is called as slot whenever the configuration has changed. @pyqtSlot() def setupServicesAndWidgets(self): # Alte Widgets löschen und Szene leeren while self.mainLayout.count(): self.mainLayout.itemAt(0).graphicsItem().deleteLater() self.mainLayout.removeAt(0) self.widgets = {} activeServices = self.configDialog.activeServices() # Falls Services eingerichtet: Service-Widgets anzeigen if activeServices: for i, service in enumerate(activeServices): nameLabel = Plasma.Label() statusIcon = Plasma.IconWidget('') self.widgets[service.id] = { 'name': nameLabel, 'status': statusIcon } nameLabel.setText(u'<strong>%s</strong>' % service.name) nameLabel.nativeWidget().setWordWrap(False) statusIcon.setMinimumHeight(22) statusIcon.setMaximumHeight(22) statusIcon.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Maximum) self.refreshStateIcon(service) self.mainLayout.addItem(statusIcon, i, 0) self.mainLayout.addItem(nameLabel, i, 1) self.iconMapper.setMapping(statusIcon, service) QObject.connect(statusIcon, SIGNAL('clicked()'), self.iconMapper, SLOT('map()')) # Falls keine Services eingerichtet: Einleitungstext anzeigen if not activeServices: self.widgets['intro'] = Plasma.Label() self.widgets['intro'].setText(self.tr('<b>Thank you for downloading<br/>Service Monitor!</b><br/><br/>Right click to open the<br/>settings dialog.')) self.mainLayout.addItem(self.widgets['intro'], 0, 0) # Hier ist das Layout eingerichtet - aktivieren self.mainLayout.activate() # Scrollbarer Bereich verkleinert sich nicht automatisch im Popup, also von Hand if hasattr(self, 'popup'): self.container.adjustSize() self.scene.setSceneRect(self.container.geometry()) # Alle Polling-Prozesse anhalten for service in self.configDialog.allServices(): service.stopPolling() # Aktive Prozesse neu einrichten und Polling starten env = self.configDialog.processEnvironment() interval = self.configDialog.pollingInterval() sleepTime = self.configDialog.sleepTime() for service in activeServices: QObject.connect(service, SIGNAL('stateChanged()'), self.serviceStateChanged) service.setProcessEnvironment(env) service.setSleepTime(sleepTime) service.setPollingInterval(interval) service.startPolling() ## [slot] Starts or stops a service corresponding to the icon clicked. # @param service The service corresponding to the clicked item, provided by self.iconMapper @pyqtSlot('QObject*') def iconClicked(self, service): if service.state[0] == 'unavailable': print 'Service %s not installed. Aborting.' % service.id return elif service.state[1] in ['active', 'starting']: service.execStopCommand() elif service.state[1] in ['inactive', 'stopping']: service.execStartCommand() self.refreshStateIcon(service) ## [slot] Updates the icon corresponding to the service which triggered this slot. @pyqtSlot() def serviceStateChanged(self): service = self.sender() self.refreshStateIcon(service) ## Updates the icon corresponding to the service argument. def refreshStateIcon(self, service): icon = KIcon(':/status-%s-%s.png' % service.state) self.widgets[service.id]['status'].setIcon(icon) ## [slot] Shows/hides popup dialog. @pyqtSlot() def togglePopup(self): if self.popup.isVisible(): self.popup.animatedHide(Plasma.Direction(0)) else: self.popup.move(self.popupPosition(self.popup.sizeHint())) self.popup.animatedShow(Plasma.Direction(0))
def __init__(self): QtGui.QMainWindow.__init__(self) self.translator = QtCore.QTranslator() lang = QtCore.QLocale.languageToString( QtCore.QLocale.system().language()) self.translator.load(lang, './tr') self.setGeometry(50, 150, 1000, 600) self.widget = MainWidget.MainWidget() self.connect(self.widget.Scheme, QtCore.SIGNAL('addColorsBar()'), self.addColorsBar) self.connect(self.widget.Scheme, QtCore.SIGNAL('activateMutation()'), self.activateMutation) self.connect(self.widget.Scheme, QtCore.SIGNAL('disactivateMutation()'), self.disactivateMutation) self.setWindowTitle(self.tr('Cognitive assistent v0.5')) self.aExit = QtGui.QAction(QtGui.QIcon('icons/exit.png'), self.tr('Quit'), self) self.aExit.setShortcut('Ctrl+Q') self.aExit.setStatusTip(self.tr('Quit')) self.connect(self.aExit, QtCore.SIGNAL('triggered()'), QtCore.SLOT('close()')) self.aSaveAs = QtGui.QAction(QtGui.QIcon('icons/save_as.png'), self.tr('Save As'), self) self.aSaveAs.setStatusTip(self.tr('Save scheme as')) self.connect(self.aSaveAs, QtCore.SIGNAL('triggered()'), self.widget.SaveListAs) self.aConfig = QtGui.QAction(QtGui.QIcon('icons/config.png'), self.tr('Configure'), self) self.aConfig.setStatusTip(self.tr('Open configure window')) self.connect(self.aConfig, QtCore.SIGNAL('triggered()'), self.config) self.aSave = QtGui.QAction(QtGui.QIcon('icons/save.png'), self.tr('Save'), self) self.aSave.setStatusTip(self.tr('Save scheme')) self.connect(self.aSave, QtCore.SIGNAL('triggered()'), self.widget.SaveList) self.aOpen = QtGui.QAction(QtGui.QIcon('icons/open.png'), self.tr('Open'), self) self.aOpen.setShortcut('Ctrl+O') self.aOpen.setStatusTip(self.tr('Select work directory')) self.connect(self.aOpen, QtCore.SIGNAL('triggered()'), self.widget.OpenList) self.aNewThesis = QtGui.QAction(QtGui.QIcon('icons/new_thesis.png'), self.tr('New thesis'), self) self.aNewThesis.setShortcut('Ctrl+N') self.aNewThesis.setStatusTip(self.tr('Add new thesis')) self.connect(self.aNewThesis, QtCore.SIGNAL('triggered()'), self.widget.AddNewThesis) self.aClearScheme = QtGui.QAction(QtGui.QIcon('icons/clear_scheme.png'), self.tr('Clear scheme'), self) self.aClearScheme.setStatusTip(self.tr('Clear scheme')) self.connect(self.aClearScheme, QtCore.SIGNAL('triggered()'), self.clearScheme) self.aNewWorkspace = QtGui.QAction(QtGui.QIcon('icons/new.png'), self.tr('Remove all'), self) self.aNewWorkspace.setStatusTip(self.tr('Remove all')) self.connect(self.aNewWorkspace, QtCore.SIGNAL('triggered()'), self.widget.NewWorkspace) self.aDelFromScheme = QtGui.QAction(QtGui.QIcon( 'icons/del_all_from_scheme.png'), self.tr( 'Remove all from scheme'), self) self.aDelFromScheme.setStatusTip(self.tr('Remove all thesis from scheme')) self.connect(self.aDelFromScheme, QtCore.SIGNAL('triggered()'), self.widget.delFromScheme) self.aZoomOrig = QtGui.QAction(QtGui.QIcon( 'icons/zoom_original.png'), self.tr('Zoom Original'), self) self.aZoomOrig.setStatusTip(self.tr('Zoom Original')) self.connect(self.aZoomOrig, QtCore.SIGNAL('triggered()'), self.widget.Scheme.resetZoom) self.aZoomIn = QtGui.QAction(QtGui.QIcon( 'icons/zoom_in.png'), self.tr('Zoom In'), self) self.aZoomIn.setShortcut('Ctrl++') self.aZoomIn.setStatusTip(self.tr('Zoom In')) self.connect(self.aZoomIn, QtCore.SIGNAL('triggered()'), self.widget.Scheme.zoomIn) self.aZoomOut = QtGui.QAction(QtGui.QIcon( 'icons/zoom_out.png'), self.tr('Zoom Out'), self) self.aZoomOut.setShortcut('Ctrl+-') self.aZoomOut.setStatusTip(self.tr('Zoom Out')) self.connect(self.aZoomOut, QtCore.SIGNAL('triggered()'), self.widget.Scheme.zoomOut) self.aInstrConvolution = QtGui.QAction(QtGui.QIcon( 'icons/convolution.png'), self.tr('Convolution'), self) self.aInstrConvolution.setStatusTip(self.tr( 'Instrument to convolution thesises')) reg = lambda: self.setInstr(Instruments.convolution) self.connect(self.aInstrConvolution, QtCore.SIGNAL('triggered()'), reg) self.aInstrGlue = QtGui.QAction(QtGui.QIcon( 'icons/glue.png'), self.tr('Glue'), self) self.aInstrGlue.setShortcut('Ctrl+G') self.aInstrGlue.setStatusTip(self.tr('Glue has made links')) reg = lambda: self.setInstr(Instruments.Glue) self.connect(self.aInstrGlue, QtCore.SIGNAL('triggered()'), reg) self.aInstrMutation = QtGui.QAction(QtGui.QIcon( 'icons/mutation.png'), self.tr('Mutation'), self) self.aInstrMutation.setShortcut('Ctrl+U') self.aInstrMutation.setStatusTip(self.tr('Mutation')) reg = lambda: self.setMutation(Instruments.Mutation) self.connect(self.aInstrMutation, QtCore.SIGNAL('triggered()'), reg) self.aInstrLamination = QtGui.QAction(QtGui.QIcon( 'icons/lamination.png'), self.tr('Lamination'), self) self.aInstrLamination.setShortcut('Ctrl+Shift+L') self.aInstrLamination.setStatusTip(self.tr('Lamination')) reg = lambda: self.setInstr(Instruments.Lamination) self.connect(self.aInstrLamination, QtCore.SIGNAL('triggered()'), reg) self.aInstrAddToScheme = QtGui.QAction(QtGui.QIcon( 'icons/add_to_scheme.png'), self.tr('Add to scheme'), self) self.aInstrAddToScheme.setStatusTip(self.tr('Add thesis to scheme')) reg = lambda: self.setInstr(Instruments.addToScheme) self.connect(self.aInstrAddToScheme, QtCore.SIGNAL('triggered()'), reg) self.aInstrMove = QtGui.QAction(QtGui.QIcon( 'icons/move.png'), self.tr('Move'), self) self.aInstrMove.setStatusTip( self.tr('This is a hand, you can move thesis on scheme with this')) self.aInstrMove.setShortcut('Ctrl+M') reg = lambda: self.setInstr(Instruments.moveView) self.connect(self.aInstrMove, QtCore.SIGNAL('triggered()'), reg) self.aInstrDelThesis = QtGui.QAction(QtGui.QIcon('icons/del_thesis.png'), self.tr('Remove thesis'), self) self.aInstrDelThesis.setStatusTip(self.tr('Instrument for remove thesis')) self.aInstrDelThesis.setShortcut('Ctrl+Shift+D') reg = lambda: self.setInstr(Instruments.delThesis) self.connect(self.aInstrDelThesis, QtCore.SIGNAL('triggered()'), reg) self.aInstrRm = QtGui.QAction(QtGui.QIcon( 'icons/del_from_scheme.png'), self.tr('Remove from scheme'), self) self.aInstrRm.setStatusTip( self.tr('Instrument for remove thesis from scheme')) self.aInstrRm.setShortcut('Ctrl+D') reg = lambda: self.setInstr(Instruments.rmView) self.connect(self.aInstrRm, QtCore.SIGNAL('triggered()'), reg) self.aInstrLink = QtGui.QAction(QtGui.QIcon( 'icons/link.png'), self.tr('Add link'), self) self.aInstrLink.setStatusTip( self.tr('Instrument for adding links')) self.aInstrLink.setShortcut('Ctrl+L') reg = lambda: self.setInstr(Instruments.createLink) self.connect(self.aInstrLink, QtCore.SIGNAL('triggered()'), reg) self.aInstrRmLink = QtGui.QAction(QtGui.QIcon( 'icons/rm_link.png'), self.tr('Remove link'), self) self.aInstrRmLink.setStatusTip( self.tr('Instrument for remove links')) reg = lambda: self.setInstr(Instruments.rmLink) self.connect(self.aInstrRmLink, QtCore.SIGNAL('triggered()'), reg) self.aInstrAddDer = QtGui.QAction(QtGui.QIcon( 'icons/add_der.png'), self.tr('Derivatives show'), self) self.aInstrAddDer.setStatusTip( self.tr('Instrument for show derivatives')) reg = lambda: self.setInstr(Instruments.addDer) self.connect(self.aInstrAddDer, QtCore.SIGNAL('triggered()'), reg) self.aInstrAddADer = QtGui.QAction(QtGui.QIcon( 'icons/add_antider.png'), self.tr('Antiderivatives show'), self) self.aInstrAddADer.setStatusTip( self.tr('Instrument for show antiderivatives')) reg = lambda: self.setInstr(Instruments.addAntider) self.connect(self.aInstrAddADer, QtCore.SIGNAL('triggered()'), reg) self.aRedColor = QtGui.QAction(QtGui.QIcon( 'icons/red.png'), self.tr('Red color'), self) self.aRedColor.setStatusTip(self.tr('Red color for mutation')) reg = lambda: self.widget.Scheme.setColor(QtCore.Qt.red) self.connect(self.aRedColor, QtCore.SIGNAL('triggered()'), reg) self.aGreenColor = QtGui.QAction(QtGui.QIcon( 'icons/green.png'), self.tr('Green color'), self) self.aGreenColor.setStatusTip(self.tr('Green color for mutation')) reg = lambda: self.widget.Scheme.setColor(QtCore.Qt.green) self.connect(self.aGreenColor, QtCore.SIGNAL('triggered()'), reg) self.aYellowColor = QtGui.QAction(QtGui.QIcon( 'icons/yellow.png'), self.tr('Yellow color'), self) self.aYellowColor.setStatusTip(self.tr('Yellow color for mutation')) reg = lambda: self.widget.Scheme.setColor(QtCore.Qt.yellow) self.connect(self.aYellowColor, QtCore.SIGNAL('triggered()'), reg) self.aDoneMut = QtGui.QAction(QtGui.QIcon( 'icons/start_mutation.png'), self.tr('Start mutation'), self) self.aDoneMut.setStatusTip(self.tr('Start mutation')) self.connect(self.aDoneMut, QtCore.SIGNAL('triggered()'), self.widget.Scheme.activateMutation) self.aDoneMut.setEnabled(0) MenuBar = self.menuBar() self.mbFile = MenuBar.addMenu(self.tr('&File')) self.mbFile.addAction(self.aNewWorkspace) self.mbFile.addAction(self.aOpen) self.mbFile.addAction(self.aSave) self.mbFile.addAction(self.aSaveAs) self.mbFile.addAction(self.aExit) self.tbWorkspace = self.addToolBar(self.tr('File')) self.tbWorkspace.addAction(self.aNewWorkspace) self.tbWorkspace.addAction(self.aOpen) self.tbWorkspace.addAction(self.aSave) self.tbWorkspace.addAction(self.aSaveAs) self.tbWorkspace.addAction(self.aConfig) self.tbInstruments = self.addToolBar(self.tr('Base instruments')) grInstr = QtGui.QActionGroup(self.tbInstruments) self.aInstrAddToScheme.setActionGroup(grInstr) self.aInstrDelThesis.setActionGroup(grInstr) self.aInstrLink.setActionGroup(grInstr) self.aInstrRmLink.setActionGroup(grInstr) self.aInstrConvolution.setActionGroup(grInstr) self.aInstrMutation.setActionGroup(grInstr) self.aInstrMove.setActionGroup(grInstr) self.aInstrRm.setActionGroup(grInstr) self.aInstrAddADer.setActionGroup(grInstr) self.aInstrAddDer.setActionGroup(grInstr) self.aInstrGlue.setActionGroup(grInstr) self.aInstrLamination.setActionGroup(grInstr) self.tbInstruments.addAction(self.aNewThesis) self.tbInstruments.addAction(self.aInstrAddToScheme) self.tbInstruments.addAction(self.aInstrDelThesis) self.tbInstruments.addAction(self.aInstrLink) self.tbInstruments.addAction(self.aInstrRmLink) self.tbInstruments.addAction(self.aInstrConvolution) self.tbInstruments.addAction(self.aInstrMutation) self.tbVisioInstr = self.addToolBar(self.tr('Visualisation instruments')) self.tbVisioInstr.addAction(self.aInstrMove) self.tbVisioInstr.addAction(self.aInstrRm) self.tbVisioInstr.addAction(self.aInstrAddADer) self.tbVisioInstr.addAction(self.aInstrAddDer) self.tbVisioInstr.addAction(self.aInstrGlue) self.tbVisioInstr.addAction(self.aInstrLamination) self.tbVisioInstr.addAction(self.aClearScheme) self.tbVisioInstr.addAction(self.aZoomIn) self.tbVisioInstr.addAction(self.aZoomOut) self.tbVisioInstr.addAction(self.aZoomOrig) self.mbBaseInstr = MenuBar.addMenu(self.tr('&Base')) self.mbVisioInstr = MenuBar.addMenu(self.tr('&Visualisation')) self.mbBaseInstr.addAction(self.aNewThesis) self.mbBaseInstr.addAction(self.aInstrAddToScheme) self.mbBaseInstr.addAction(self.aInstrDelThesis) self.mbBaseInstr.addAction(self.aInstrLink) self.mbBaseInstr.addAction(self.aInstrRmLink) self.mbBaseInstr.addAction(self.aInstrConvolution) self.mbBaseInstr.addAction(self.aInstrMutation) self.mbVisioInstr.addAction(self.aInstrMove) self.mbVisioInstr.addAction(self.aInstrRm) self.mbVisioInstr.addAction(self.aInstrAddADer) self.mbVisioInstr.addAction(self.aInstrAddDer) self.mbVisioInstr.addAction(self.aInstrGlue) self.mbVisioInstr.addAction(self.aInstrLamination) self.mbVisioInstr.addAction(self.aClearScheme) self.mbVisioInstr.addAction(self.aZoomIn) self.mbVisioInstr.addAction(self.aZoomOut) self.mbVisioInstr.addAction(self.aZoomOrig) for instr in grInstr.actions(): instr.setCheckable(1) grInstr.setExclusive(1) self.aInstrMove.setChecked(1) self.tbColors = None # self.statusBar() self.cfgDialog = ConfigDialog.cfgDialog(self) self.connect(self.cfgDialog, QtCore.SIGNAL('ChangeLanguage(QString *)'), self.changLang) self.setCentralWidget(self.widget)