def initUI (self): vbox = QtGui.QVBoxLayout() self.grid = QtGui.QGridLayout() vbox.addLayout (self.grid) RadioManagement.__init__ (self, self.radioCol, self.grid) # Set window properties self.setGeometry (300, 300, 290, 150) self.setWindowTitle ("Manage Execution Delegates") self.setLayout (vbox) self.initDelAndMovButtons (vbox) # Insert "new" button start of edit buttons. self.newParamBtn = QtGui.QPushButton ("New &Delegate", self) self.newParamBtn.clicked.connect (self.newDelegateButtonClicked) self.editHBox.insertWidget (0, self.newParamBtn) controlButtonLayout = QtGui.QHBoxLayout() vbox.addLayout (controlButtonLayout) # O.K. and cancel buttons. button = QtGui.QPushButton ("&cancel", self) controlButtonLayout.addWidget (button) self.connect (button, SIGNAL ('clicked()'), SLOT ('reject()')) button = QtGui.QPushButton ("&O.K.", self) button.setDefault(True) controlButtonLayout.addWidget (button) button.clicked.connect (self.okBtnClicked)
def initUI (self): vbox = QtGui.QVBoxLayout() grid = QtGui.QGridLayout() vbox.addLayout (grid) # Set window properties self.setGeometry (300, 300, 290, 150) self.setWindowTitle ("Add New Script") self.setLayout (vbox) # Setup widgets. # Name self.nameLabel = QtGui.QLabel ("Name", self) grid.addWidget (self.nameLabel, 0, 0) self.name = QtGui.QLineEdit (self) grid.addWidget (self.name, 0, 1) # Command self.nameLabel = QtGui.QLabel ("Command", self) grid.addWidget (self.nameLabel, 1, 0) self.command = QtGui.QLineEdit (self) grid.addWidget (self.command, 1, 1) self.cmdBtn = QtGui.QPushButton ("...", self) moreFilesWidth = self.cmdBtn.fontMetrics().boundingRect ("...").width() self.cmdBtn.setMaximumWidth (moreFilesWidth + 15) grid.addWidget (self.cmdBtn, 1, 2) self.cmdBtn.clicked.connect (self.cmdBtnClicked) # Execution delegate label = QtGui.QLabel ("Using", self) grid.addWidget (label, 2, 0) execBox = QtGui.QHBoxLayout() grid.addLayout (execBox, 2, 1) self.execDelegate = QtGui.QComboBox (self) #grid.addWidget (self.execDelegate, 2, 1) execBox.addWidget (self.execDelegate) execBox.setStretch (0, 1) # combo box get largest share of space. self.execEditBtn = QtGui.QPushButton ("configure", self) self.execEditBtn.clicked.connect (self.execEditBtnClicked) execBox.addWidget (self.execEditBtn) self.populateUsingComboBox() # A horizontal rule. line = QtGui.QFrame (self) line.setFrameShape (QtGui.QFrame.HLine) line.setFrameShadow (QtGui.QFrame.Sunken) vbox.addWidget (line) # "Parameters" label. label = QtGui.QLabel ("Parameters", self) vbox.addWidget (label, 0, Qt.Alignment (4)) font = QtGui.QFont (self) font.setPointSize (16) label.setFont (font) # Parameter box. self.paramLayout = QtGui.QGridLayout() vbox.addLayout (self.paramLayout) # grid column stretches most self.paramLayout.setColumnStretch (1, 1) RadioManagement.__init__ (self, self.radioCol, self.paramLayout) self.initDelAndMovButtons (vbox) # Insert "new" button start of edit buttons. self.newParamBtn = QtGui.QPushButton ("New &Param", self) self.newParamBtn.clicked.connect (self.newParamBtnClicked) self.editHBox.insertWidget (0, self.newParamBtn) # A horizontal rule. line = QtGui.QFrame (self) line.setFrameShape (QtGui.QFrame.HLine) line.setFrameShadow (QtGui.QFrame.Sunken) vbox.addWidget (line) controlButtonLayout = QtGui.QHBoxLayout() vbox.addLayout (controlButtonLayout) # Control buttons. self.cancelBtn = QtGui.QPushButton ("&cancel", self) controlButtonLayout.addWidget (self.cancelBtn) self.connect (self.cancelBtn, SIGNAL ('clicked()'), SLOT ('reject()')) self.okBtn = QtGui.QPushButton ("&ok", self) self.okBtn.setDefault(True) controlButtonLayout.addWidget (self.okBtn) self.okBtn.clicked.connect (self.okBtnClicked) self.show()
def initUI (self): # Set the icon for the window. imageDir = ConfigManager.getPyapplaunchImageDir() self.setWindowIcon (QtGui.QIcon (os.path.join (imageDir, "pyapplaunch.png"))) QtGui.QShortcut (QtGui.QKeySequence ("Esc"), self, self.hide) QtGui.QShortcut (QtGui.QKeySequence ("Ctrl+Q"), self, self.quit) # Exit action for menus. self.exitAction = QtGui.QAction(QtGui.QIcon ('exit.png'), '&Exit', self) self.exitAction.setShortcut ('Ctrl+Q') self.exitAction.setStatusTip ('Exit application') self.exitAction.triggered.connect (self.quit) # Add a "home" shortcut key to return to the root context. QtGui.QShortcut (QtGui.QKeySequence ("-"), self, self.returnToHomeContext) # Add a "home" shortcut key to return to the root context. QtGui.QShortcut (QtGui.QKeySequence ("/"), self, self.contextUpLevel) #menubar = self.menuBar() #fileMenu = menubar.addMenu ('&File') #fileMenu.addAction (self.exitAction) self.mainWidget = QtGui.QWidget (self) # dummy to contain the layout. self.setCentralWidget (self.mainWidget) vbox = QtGui.QVBoxLayout() vbox.addStretch (1) # This layout will hold the script buttons once they're generated. self.buttonLayout = QtGui.QGridLayout() vbox.addLayout (self.buttonLayout) self.buttonLayout.setColumnStretch (self.btnCol, 1) # Btn column stretches most. RadioManagement.__init__ (self, self.radioCol, self.buttonLayout) # A horizontal rule. line = QtGui.QFrame (self) line.setFrameShape (QtGui.QFrame.HLine) line.setFrameShadow (QtGui.QFrame.Sunken) vbox.addWidget (line) # Insert the control buttons for managemnt of the generated buttons. self.initDelAndMovButtons (vbox) # Insert the edit button at the beginning of the edit box. button = QtGui.QPushButton ("&Edit", self) self.editHBox.insertWidget (0, button) # 0 = beginning of hbox. self.connect (button, SIGNAL ("clicked()"), self.editButtonClicked) newLayout = QtGui.QHBoxLayout() vbox.addLayout (newLayout) # The new script button. newAppBtn = QtGui.QPushButton ("&New Script", self) newLayout.addWidget (newAppBtn) self.connect (newAppBtn, SIGNAL ("clicked()"), self.showNewApp) # New Group button. newGroupBtn = QtGui.QPushButton ("New &Group", self) newLayout.addWidget (newGroupBtn) self.connect (newGroupBtn, SIGNAL ("clicked()"), self.newGroupBtnClicked) self.mainWidget.setLayout (vbox) self.setWindowTitle ("PyLaunch - /")