def __init__(self): super(PhoneFrame, self).__init__() self.setWindowTitle('Phone Book.') self.name = QLineEdit() self.number = QLineEdit() entry = QFormLayout() entry.addRow(QLabel('Name'), self.name) entry.addRow(QLabel('Number'), self.number) buttons = QHBoxLayout() button = QPushButton('&Add') button.clicked.connect(self._addEntry) buttons.addWidget(button) button = QPushButton('&Update') button.clicked.connect(self._updateEntry) buttons.addWidget(button) button = QPushButton('&Delete') button.clicked.connect(self._deleteEntry) buttons.addWidget(button) dataDisplay = QTableView() dataDisplay.setModel(PhoneDataModel()) layout = QVBoxLayout() layout.addLayout(entry) layout.addLayout(buttons) layout.addWidget(dataDisplay) self.setLayout(layout) self.show()
def addTab(self, label ): layoutWidget = QWidget() vLayout = QVBoxLayout(layoutWidget) vLayout.setContentsMargins(5,5,5,5) setFolderLayout = QHBoxLayout() listWidget = QListWidget() listWidget.setSelectionMode( QAbstractItemView.ExtendedSelection ) vLayout.addLayout( setFolderLayout ) vLayout.addWidget( listWidget ) lineEdit = QLineEdit() setFolderButton = QPushButton( 'Set Folder' ) setFolderLayout.addWidget( lineEdit ) setFolderLayout.addWidget( setFolderButton ) QtCore.QObject.connect( setFolderButton, QtCore.SIGNAL( 'clicked()' ), Functions.setFolder ) QtCore.QObject.connect( listWidget, QtCore.SIGNAL( 'itemSelectionChanged()' ), Functions.loadImagePathArea ) QtCore.QObject.connect( lineEdit, QtCore.SIGNAL( 'textChanged()' ), Functions.lineEdited ) listWidget.setObjectName( Window_global.listWidgetObjectName ) lineEdit.setContextMenuPolicy( QtCore.Qt.NoContextMenu ) lineEdit.setObjectName( Window_global.lineEditObjectName ) lineEdit.returnPressed.connect( Functions.lineEdited ) super( Tab, self ).addTab( layoutWidget, label )
def __init__(self, renderController, parent=None): super(RenderPropWidget, self).__init__(parent=parent) # Three tabs: Visualization, data info and slices self.visParamTabWidget = RenderParameterWidget(renderController) self.dataInfoTabWidget = RenderInfoWidget() self.slicesTabWidget = RenderSlicerParamWidget(renderController) # Create the load dataset widget self.loadDataWidget = QWidget() self.loadDataButton = QPushButton() self.loadDataButton.setText("Load a dataset") layout = QVBoxLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.loadDataButton) self.loadDataWidget.setLayout(layout) # Create the tab widget self.tabWidget = QTabWidget() self.tabWidget.addTab(self.visParamTabWidget, "Visualization") self.tabWidget.addTab(self.dataInfoTabWidget, "Data info") self.tabWidget.addTab(self.slicesTabWidget, "Slices") layout = QVBoxLayout() layout.addWidget(self.loadDataWidget) self.setLayout(layout)
def _setup_ui(self): self._btn_pick_1.setFixedWidth(25) self._btn_pick_1.setToolTip('Pick first sequence.') self._btn_pick_2.setFixedWidth(25) self._btn_pick_2.setToolTip('Pick second sequence.') self._btn_compare.setToolTip('Compare sequences.') self._progress_bar.setFixedHeight(10) lyt_seq1 = QHBoxLayout() lyt_seq1.addWidget(self._ledit1) lyt_seq1.addWidget(self._btn_pick_1) lyt_seq2 = QHBoxLayout() lyt_seq2.addWidget(self._ledit2) lyt_seq2.addWidget(self._btn_pick_2) lyt_main = QVBoxLayout() lyt_main.addLayout(lyt_seq1) lyt_main.addLayout(lyt_seq2) lyt_main.addWidget(self._btn_compare) main_widget = QWidget() main_widget.setLayout(lyt_main) self.setCentralWidget(main_widget)
def _create_contents ( self, parent ): lay = QVBoxLayout() lay.addWidget( self._create_dialog_area( parent ) ) lay.addWidget( self._create_buttons( parent ) ) parent.setLayout( lay )
def __init__(self,parent=None): super(QtReducePreferencesComputation,self).__init__(parent) reduceGroup = QGroupBox("Reduce") self.reduceBinary = QLineEdit() # font = self.reduceBinary.font() # font.setFamily(QSettings().value("worksheet/fontfamily", # QtReduceDefaults.FONTFAMILY)) # self.reduceBinary.setFont(font) self.reduceBinary.setText(QSettings().value("computation/reduce", QtReduceDefaults.REDUCE)) self.reduceBinary.editingFinished.connect(self.editingFinishedHandler) reduceLayout = QFormLayout() reduceLayout.addRow(self.tr("Reduce Binary"),self.reduceBinary) reduceGroup.setLayout(reduceLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(reduceGroup) self.setLayout(mainLayout)
def __init__(self, parent, *args, **kw): super(_FilterTableView, self).__init__(*args, **kw) layout = QVBoxLayout() layout.setSpacing(2) self.table = table = _myFilterTableView(parent) table.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) # table.setMinimumHeight(100) # table.setMaximumHeight(50) table.setFixedHeight(50) # table.setFixedWidth(50) hl = QHBoxLayout() self.button = button = QPushButton() button.setIcon(icon('delete').create_icon()) button.setEnabled(False) button.setFlat(True) button.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Fixed) button.setFixedWidth(25) self.text = text = QLineEdit() hl.addWidget(text) hl.addWidget(button) layout.addLayout(hl) layout.addWidget(table) self.setLayout(layout)
def setup_gui(self): """Sets up a sample gui interface.""" central_widget = QWidget(self) central_widget.setObjectName('central_widget') self.label = QLabel('Hello World') self.input_field = QLineEdit() change_button = QPushButton('Change text') close_button = QPushButton('close') quit_button = QPushButton('quit') central_layout = QVBoxLayout() button_layout = QHBoxLayout() central_layout.addWidget(self.label) central_layout.addWidget(self.input_field) # a separate layout to display buttons horizontal button_layout.addWidget(change_button) button_layout.addWidget(close_button) button_layout.addWidget(quit_button) central_layout.addLayout(button_layout) central_widget.setLayout(central_layout) self.setCentralWidget(central_widget) # create a system tray icon. Uncomment the second form, to have an # icon assigned, otherwise you will only be seeing an empty space in # system tray self.systemtrayicon = QSystemTrayIcon(self) self.systemtrayicon.show() # set a fancy icon self.systemtrayicon.setIcon(QIcon.fromTheme('help-browser')) change_button.clicked.connect(self.change_text) quit_button.clicked.connect(QApplication.instance().quit) close_button.clicked.connect(self.hide) # show main window, if the system tray icon was clicked self.systemtrayicon.activated.connect(self.icon_activated)
def __init__(self): QWidget.__init__(self) layout = QVBoxLayout(self) label = QLabel() listWidget = QListWidget() listWidget.setSelectionMode(QAbstractItemView.ExtendedSelection) hLayout = QHBoxLayout() buttonLoad = QPushButton("LOAD") buttonRemove = QPushButton("REMOVE") hLayout.addWidget(buttonLoad) hLayout.addWidget(buttonRemove) layout.addWidget(label) layout.addWidget(listWidget) layout.addLayout(hLayout) self.label = label self.listWidget = listWidget self.buttonLoad = buttonLoad self.buttonRemove = buttonRemove QtCore.QObject.connect(self.buttonLoad, QtCore.SIGNAL('clicked()'), self.loadCommand) QtCore.QObject.connect(self.buttonRemove, QtCore.SIGNAL('clicked()'), self.removeCommand)
def __init__(self, choices, title = "select one from choices", parent = None): super(ChoiceDialog, self).__init__(parent) layout = QVBoxLayout(self) self.choiceButtonGroup=QButtonGroup(parent) # it is not a visible UI self.choiceButtonGroup.setExclusive(True) if choices and len(choices)>=1: self.choices = choices for id, choice in enumerate(self.choices): rb = QRadioButton(choice) self.choiceButtonGroup.addButton(rb) self.choiceButtonGroup.setId(rb, id) # negative id if not specified layout.addWidget(rb) self.choiceButtonGroup.buttonClicked.connect(self.choiceChanged) # OK and Cancel buttons buttons = QDialogButtonBox( QDialogButtonBox.Ok | QDialogButtonBox.Cancel, Qt.Horizontal, self) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject) layout.addWidget(buttons) self.setLayout(layout) self.setWindowTitle(title)
def __init__(self): QWidget.__init__(self) self.title = u"执行" # View RunDef self.__wid_run_def = ViewRunDef() # View ReportDet self.__wid_report_det = ViewReportDet() # Search condition widget self.__wid_search_cond = ViewSearch(def_view_run_def) self.__wid_search_cond.create() # 底部 layout _layout_bottom = QSplitter() _layout_bottom.addWidget(self.__wid_run_def) _layout_bottom.addWidget(self.__wid_report_det) # main layout _layout = QVBoxLayout() _layout.addWidget(self.__wid_search_cond) _layout.addWidget(_layout_bottom) _layout.setContentsMargins(0, 0, 0, 0) self.setLayout(_layout) self.__wid_run_def.sig_search.connect(self.search) self.__wid_run_def.sig_selected.connect( self.__wid_report_det.usr_refresh)
class FoamBoundaryWidget(QWidget): """boundary_settings is a python dict with varible as key and OrderedDictionary as value""" def __init__(self, boundary_settings, parent=None): super(FoamBoundaryWidget, self).__init__(parent) assert (boundary_settings) # each variable could have empty dict self.tabWidget = QTabWidget() self.tabs = OrderedDict() for variable in boundary_settings.keys(): vtab = FoamDictWidget(boundary_settings[variable], self) # accept empty or None self.tabs[variable] = vtab if variable in _VARIABLE_NAMES.keys(): variable_name = _VARIABLE_NAMES[variable] else: variable_name = variable self.tabWidget.addTab(vtab, variable_name) self.tabWidget.resize(300, 300) self.myLayout = QVBoxLayout() help_text = """keys and values are raw string (without ;) e.g. 'uniform (1 0 0)' leave the table empty if do not want to overwrite setting by raw dict in this table """ self.myLayout.addWidget(QLabel(help_text)) self.myLayout.addWidget(self.tabWidget) self.setLayout(self.myLayout) def boundarySettings(self): _bcs = {} for variable in self.tabs: _bcs[variable] = self.tabs[variable].dict() return _bcs
class qlabeled_entry(QWidget): def __init__(self, var, text, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.efield = QLineEdit("Default Text") # self.efield.setMaximumWidth(max_size) self.efield.setFont(QFont('SansSerif', 12)) self.label = QLabel(text) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.efield) self.var = var self.efield.textChanged.connect(self.when_modified) def when_modified(self): self.var.set(self.efield.text()) def hide(self): QWidget.hide(self)
def makeContent(self): ''' Override this method to return the layout with the contents of this screen. ''' l = QVBoxLayout() l.addWidget(QLabel("This Screen Intentionally Left Blank")) return l
def _updateView(self, data=None): ''' ''' #wrap it in a try-catch try: #if the data argument is not None #assign it to the instance var data if data: self.data = data if not self.fig: # on first plot self.dpi = self.logicalDpiX() logging.info("Plotting at %s dpi." % self.dpi) self.fig = Figure(dpi=self.dpi) self.canvas = FigureCanvas(self.fig) self.axes = self.fig.add_subplot(111) self.mpl_toolbar = NavigationToolbar(self.canvas, None) left_vbox = QVBoxLayout(self.plotWrapper) left_vbox.addWidget(self.canvas) left_vbox.addWidget(self.mpl_toolbar) self.setAxesAndData() self.canvas.draw() else: self.axes.clear() self.setAxesAndData() self.canvas.draw() except Exception as e: logging.debug("PlotWidgetController._updateView: Error occurred: %s" % e)
def __init__(self, parent, dao): super(EditTaskTeamDialog, self).__init__(parent) self.setModal(True) self.team_out_scene = EmployeePicturePlanScene(self) for employee in dao.all(): self.team_out_scene.addItem( SelectableEmployeePictureItem( employee.picture(), employee)) # Scene takes ownership of the item self.team_out_view = QGraphicsView(self.team_out_scene, self) self.team_out_view.setAlignment(Qt.AlignLeft | Qt.AlignTop) buttons = QDialogButtonBox(self) buttons.addButton(QDialogButtonBox.StandardButton.Cancel) buttons.addButton(QDialogButtonBox.Ok) top_layout = QVBoxLayout(self) top_layout.addWidget(self.team_out_view) top_layout.addWidget(buttons) self.setLayout(top_layout) buttons.accepted.connect(self.accept) buttons.rejected.connect(self.reject)
def OnCreate(self, form): # if HAS_PYSIDE: # self.parent = self.FormToPySideWidget(form) # else: self.parent = self.FormToPyQtWidget(form) self.tv = QTreeView() self.tv.setExpandsOnDoubleClick(False) root_layout = QVBoxLayout(self.parent) # self.le_filter = QLineEdit(self.parent) # root_layout.addWidget(self.le_filter) root_layout.addWidget(self.tv) self.parent.setLayout(root_layout) self._model = QtGui.QStandardItemModel() self._init_model() self.tv.setModel(self._model) self.tv.setColumnWidth(0, 200) self.tv.setColumnWidth(1, 300) self.tv.header().setStretchLastSection(True) self.tv.expandAll() self.tv.doubleClicked.connect(self.on_navigate_to_method_requested)
class WallframeAppButton(QWidget): def __init__(self, app_tag, app_image_path, app_description_path): QWidget.__init__(self) # App tag self.app_tag_ = QLabel(app_tag) # App image app_image = QPixmap() app_image.load(app_image_path) self.app_image_ = QLabel() self.app_image_.setPixmap(app_image) # App description try: f = open(app_description_path, "r") self.app_description_ = f.read() f.close() except: print "Error opening description. Quitting." self.setToolTip(self.app_description_) # Layout the child widgets self.child_layout_ = QVBoxLayout() self.child_layout_.addWidget(self.app_image_) self.child_layout_.addWidget(self.app_tag_) self.setLayout(self.child_layout_)
def __init__(self, theScene, parent): """ Default class constructor. :param `theScene`: TOWRITE :type `theScene`: `QGraphicsScene`_ :param `parent`: Pointer to a parent widget instance. :type `parent`: `QWidget`_ """ super(EmbDetailsDialog, self).__init__(parent) self.setMinimumSize(750, 550) self.getInfo() mainWidget = self.createMainWidget() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok) buttonBox.accepted.connect(self.accept) vboxLayoutMain = QVBoxLayout(self) vboxLayoutMain.addWidget(mainWidget) vboxLayoutMain.addWidget(buttonBox) self.setLayout(vboxLayoutMain) self.setWindowTitle(self.tr("Embroidery Design Details")) QApplication.setOverrideCursor(Qt.ArrowCursor)
def generate_dialogs(self): vlayout = QVBoxLayout() commit_button = QPushButton("&Commit") w_all = QWidget() v = QVBoxLayout() for cell in self.plasm.cells(): tendril_widgets = [] for name, tendril in cell.params: if self.whitelist is None or self.is_in_whitelist(cell.name(), name): tw = TendrilWidget(name, tendril) commit_button.clicked.connect(tw.thunker.commit) tendril_widgets.append(tw) if tendril_widgets: w = QWidget() cvlayout = QVBoxLayout() cvlayout.addWidget(QLabel(cell.name())) for tendril_widget in tendril_widgets: cvlayout.addWidget(tendril_widget) w.setLayout(cvlayout) # w.setSizePolicy(QSizePolicy.Minimum, QSizePolicy.Minimum) v.addWidget(w) w_all.setLayout(v) s = QScrollArea() s.setWidget(w_all) vlayout.addWidget(s) vlayout.addWidget(commit_button) self.setLayout(vlayout)
def __init__(self, parent): super(ElastixMainDialog, self).__init__(parent) self.transformation = None self.transformations = AppResources.elastixTemplates() self.radioButtons = [] for transformation in self.transformations: self.radioButtons.append(QRadioButton(transformation.name)) self.radioButtons.append(QRadioButton("Load custom parameter file...")) self.radioButtons[0].setChecked(True) self.nextButton = QPushButton("Next") self.nextButton.clicked.connect(self.next) self.cancelButton = QPushButton("Cancel") self.cancelButton.clicked.connect(self.cancel) groupLayout = QVBoxLayout() for radioButton in self.radioButtons: groupLayout.addWidget(radioButton) self.groupBox = QGroupBox("Choose parameter file") self.groupBox.setLayout(groupLayout) self.setModal(True) layout = QGridLayout() layout.setAlignment(Qt.AlignTop) layout.addWidget(self.groupBox, 0, 0, 1, 2) layout.addWidget(self.cancelButton, 1, 0) layout.addWidget(self.nextButton, 1, 1) self.setLayout(layout)
def createLayouts(self): """Put widgets into layouts, thus creating the widget""" mainLayout = QHBoxLayout() fieldsLayout = QVBoxLayout() pathLayout = QHBoxLayout() buttonLayout = QHBoxLayout() mainLayout.addStretch(10) fieldsLayout.addStretch(50) fieldsLayout.addWidget(self.linkLabel) fieldsLayout.addWidget(self.line) fieldsLayout.addWidget(self.localdirLabel) pathLayout.addWidget(self.localdirEdit) pathLayout.addWidget(self.browseButton) fieldsLayout.addLayout(pathLayout) buttonLayout.addStretch(50) buttonLayout.addWidget(self.syncButton, 50, Qt.AlignRight) fieldsLayout.addLayout(buttonLayout) fieldsLayout.addStretch(10) fieldsLayout.addWidget(self.statusLabel) fieldsLayout.addWidget(self.status) fieldsLayout.addStretch(80) mainLayout.addLayout(fieldsLayout, 60) mainLayout.addStretch(10) self.setLayout(mainLayout)
def __init__(self, config, parent=None, **kwargs): QWidget.__init__(self, parent) self.startTime = None self.numDataPoints = 0 self.datasets = {} for display in config['displays']: self.datasets[display['field']] = self.createDatasetForDisplay(display) self.graph = PlotWidget(title=config['title'], labels=config['labels']) # Only add a legend to the graph if there is more than one dataset displayed on it if len(self.datasets) > 1: self.graph.addLegend() # Show grid lines self.graph.showGrid(x=True, y=True) for _, dataset in self.datasets.items(): self.graph.addItem(dataset['plotData']) vbox = QVBoxLayout() vbox.addWidget(self.graph) self.setLayout(vbox)
def __init__(self, parameter, parent=None): _ParameterWidget.__init__(self, parameter, parent) # Variables model = _LayerModel() self._material_class = Material # Actions act_add = QAction(getIcon("list-add"), "Add layer", self) act_remove = QAction(getIcon("list-remove"), "Remove layer", self) act_clean = QAction(getIcon('edit-clear'), "Clear", self) # Widgets self._cb_unit = UnitComboBox('m') self._cb_unit.setUnit('um') self._tbl_layers = QTableView() self._tbl_layers.setModel(model) self._tbl_layers.setItemDelegate(_LayerDelegate()) header = self._tbl_layers.horizontalHeader() header.setResizeMode(QHeaderView.Stretch) header.setStyleSheet('color: blue') self._tlb_layers = QToolBar() spacer = QWidget() spacer.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._tlb_layers.addWidget(spacer) self._tlb_layers.addAction(act_add) self._tlb_layers.addAction(act_remove) self._tlb_layers.addAction(act_clean) # Layouts layout = QVBoxLayout() layout.setContentsMargins(0, 0, 0, 0) sublayout = QHBoxLayout() sublayout.addStretch() sublayout.addWidget(QLabel('Thickness unit')) sublayout.addWidget(self._cb_unit) layout.addLayout(sublayout) layout.addWidget(self._tbl_layers) layout.addWidget(self._tlb_layers) self.setLayout(layout) # Signals self.valuesChanged.connect(self._onChanged) self.validationRequested.connect(self._onChanged) act_add.triggered.connect(self._onAdd) act_remove.triggered.connect(self._onRemove) act_clean.triggered.connect(self._onClear) self._tbl_layers.doubleClicked.connect(self._onDoubleClicked) model.dataChanged.connect(self.valuesChanged) model.rowsInserted.connect(self.valuesChanged) model.rowsRemoved.connect(self.valuesChanged) self.validationRequested.emit()
def __init__(self): QWidget.__init__(self) self.title = u"页面" # Search condition widget self.__wid_search_cond = ViewSearch(def_view_page_def) self.__wid_search_cond.set_col_num(2) self.__wid_search_cond.create() # Column widget self.__wid_page_def = ViewPageDefMag() self.__wid_page_det = ViewPageDetMag() # Bottom layout _layout_bottom = QHBoxLayout() _layout_bottom.addWidget(self.__wid_page_def) _layout_bottom.addWidget(self.__wid_page_det) # Main layout _layout_main = QVBoxLayout() _layout_main.addWidget(self.__wid_search_cond) _layout_main.addLayout(_layout_bottom) _layout_main.setContentsMargins(0, 0, 0, 0) _layout_main.setSpacing(0) self.setLayout(_layout_main) self.__wid_page_def.sig_selected.connect( self.__wid_page_det.set_page_id) self.__wid_page_def.sig_search.connect(self.search_definition) self.__wid_page_def.sig_delete.connect(self.__wid_page_det.clean) self.__wid_page_det.sig_selected[str].connect(self.sig_selected.emit)
def _layout_indicators(self, indicators): subframes = [] ind_vlayout = QVBoxLayout() for line in indicators: hboxlayout = QHBoxLayout() hboxlayout.addStretch() hboxlayout.setAlignment(Qt.AlignTop) for ind in line[1:]: if type(ind) == list: deeper_layout, deeper_subframes = self._layout_indicators( ind) subframes += deeper_subframes hboxlayout.addLayout(deeper_layout) else: hboxlayout.addWidget(ind) hboxlayout.addStretch() s = SubFrame(line[0], hboxlayout, self) subframes.append(s) ind_vlayout.addWidget(s) return ind_vlayout, subframes
def __init__(self, *args, **kwargs ): QWidget.__init__( self, *args ) title = "" if kwargs.has_key( 'title' ): title = kwargs['title'] self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_LoadVertex_%s.txt" % title sgCmds.makeFile( self.infoPath ) vLayout = QVBoxLayout( self ); vLayout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) groupBox.setAlignment( QtCore.Qt.AlignCenter ) vLayout.addWidget( groupBox ) hLayout = QHBoxLayout() lineEdit = QLineEdit() button = QPushButton("Load"); button.setFixedWidth( 50 ) hLayout.addWidget( lineEdit ) hLayout.addWidget( button ) groupBox.setLayout( hLayout ) self.lineEdit = lineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.loadVertex ) self.loadInfo()
def __init__(self): super(STM32FProgrammerDialog, self).__init__(CWMainGUI.getInstance()) # self.setWindowFlags(self.windowFlags() | Qt.WindowStaysOnTopHint) self.stm32f = STM32FProgrammer() self.setWindowTitle("Serial STM32F Programmer") layout = QVBoxLayout() layoutFW = QHBoxLayout() self.flashLocation = QtFixes.QLineEdit() flashFileButton = QPushButton("Find") flashFileButton.clicked.connect(self.findFlash) layoutFW.addWidget(QLabel("FLASH File")) layoutFW.addWidget(self.flashLocation) layoutFW.addWidget(flashFileButton) layout.addLayout(layoutFW) self.flashLocation.setText(QSettings().value("stm32f-flash-location")) # Add buttons readSigBut = QPushButton("Check Signature") readSigBut.clicked.connect(self.readSignature) verifyFlashBut = QPushButton("Verify FLASH") verifyFlashBut.clicked.connect(self.verifyFlash) verifyFlashBut.setEnabled(False) progFlashBut = QPushButton("Erase/Program/Verify FLASH") progFlashBut.clicked.connect(self.writeFlash) layoutBut = QHBoxLayout() layoutBut.addWidget(readSigBut) layoutBut.addWidget(verifyFlashBut) layoutBut.addWidget(progFlashBut) layout.addLayout(layoutBut) layoutsetting = QHBoxLayout() mode = QComboBox() mode.addItem("fast", False) mode.addItem("slow", True) mode.currentIndexChanged.connect(self.modechanged) layoutsetting.addWidget(QLabel("Speed:")) layoutsetting.addWidget(mode) blocksize = QComboBox() blocksize.addItem("256", False) blocksize.addItem("64", True) blocksize.currentIndexChanged.connect(self.blocksizechanged) layoutsetting.addStretch() layoutsetting.addWidget(QLabel("Read Block Size:")) layoutsetting.addWidget(blocksize) layout.addLayout(layoutsetting) # Add status stuff self.statusLine = QPlainTextEdit() self.statusLine.setReadOnly(True) # self.statusLine.setFixedHeight(QFontMetrics(self.statusLine.font()).lineSpacing() * 5 + 10) self.stm32f.newTextLog.connect(self.append) layout.addWidget(self.statusLine) # Set dialog layout self.setLayout(layout)
def __init__(self, title, *args, **kwargs ): QWidget.__init__( self, *args ) self.infoPath = cmds.about(pd=True) + "/sg/fingerWeightCopy/Widget_loadJoints_%s.txt" % title sgCmds.makeFile( self.infoPath ) layout = QVBoxLayout( self ); layout.setContentsMargins(0,0,0,0) groupBox = QGroupBox( title ) layout.addWidget( groupBox ) baseLayout = QVBoxLayout() groupBox.setLayout( baseLayout ) listWidget = QListWidget() hl_buttons = QHBoxLayout(); hl_buttons.setSpacing( 5 ) b_addSelected = QPushButton( "Add Selected" ) b_clear = QPushButton( "Clear" ) hl_buttons.addWidget( b_addSelected ) hl_buttons.addWidget( b_clear ) baseLayout.addWidget( listWidget ) baseLayout.addLayout( hl_buttons ) self.listWidget = listWidget QtCore.QObject.connect( listWidget, QtCore.SIGNAL( "itemClicked(QListWidgetItem*)" ), self.selectJointFromItem ) QtCore.QObject.connect( b_addSelected, QtCore.SIGNAL("clicked()"), self.addSelected ) QtCore.QObject.connect( b_clear, QtCore.SIGNAL( "clicked()" ), self.clearSelected ) self.otherWidget = None self.loadInfo()
class qLabeledCheck(QWidget): def __init__(self, name, arg_dict, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.cbox = QCheckBox() # self.efield.setMaximumWidth(max_size) self.cbox.setFont(QFont('SansSerif', 12)) self.label = QLabel(name) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.cbox) self.arg_dict = arg_dict self.name = name self.mytype = type(self.arg_dict[name]) if self.mytype != bool: self.cbox.setChecked(bool(self.arg_dict[name])) else: self.cbox.setChecked(self.arg_dict[name]) self.cbox.toggled.connect(self.when_modified) self.when_modified() def when_modified(self): self.arg_dict[self.name] = self.cbox.isChecked() def hide(self): QWidget.hide(self)
def __init__(self, velocity, obj=None, parent=None): super(VectorInputWidget, self).__init__(parent) # for both py2 and py3 self.valueTypes = ['Cartisan components'] NumberOfComponents = 3 vector_config = [['vector'], ['vector'], ['vector'], ['Vx', 'Vy', 'Vz'], ['m/s'] * NumberOfComponents, [[True] * NumberOfComponents]] self.componentWidget = InputWidget(None, vector_config) self.forms = [self.componentWidget] if within_FreeCADGui: self.valueTypes += ['Magnitude and normal'] self.magNormalWidget = MagnitudeNormalWidget(velocity, obj, self) self.forms += [self.magNormalWidget.form] #create 2 widgets and select diff way valueTypeTips = self.valueTypes self.buttonGroupValueType, _buttonGroupLayout = _createChoiceGroup( self.valueTypes, valueTypeTips) self.buttonGroupValueType.buttonClicked.connect( self.valueTypeChanged) # diff conect syntax self.currentValueType = self.valueTypes[0] _layout = QVBoxLayout() #_layout.addWidget(self.labelHelpText) _layout.addLayout(_buttonGroupLayout) for w in self.forms: _layout.addWidget(w) self.setLayout(_layout) self.setVector(velocity)
def __init__(self): super(STMainWindow, self).__init__() self.createActions() self.createMenus() layout = QVBoxLayout() self.tabs = QTabWidget() self.tabs.setTabPosition(QTabWidget.West) self.tabs.currentChanged[int].connect(self.tabChanged) self.sessiontab = sweattrails.qt.sessiontab.SessionTab(self) self.tabs.addTab(self.sessiontab, "Sessions") self.tabs.addTab(sweattrails.qt.fitnesstab.FitnessTab(self), "Fitness") self.tabs.addTab(sweattrails.qt.profiletab.ProfileTab(self), "Profile") self.usertab = sweattrails.qt.usertab.UserTab(self) self.tabs.addTab(self.usertab, "Users") self.usertab.hide() layout.addWidget(self.tabs) w = QWidget(self) w.setLayout(layout) self.setCentralWidget(w) self.statusmessage = QLabel() self.statusmessage.setMinimumWidth(200) self.statusBar().addPermanentWidget(self.statusmessage) self.progressbar = QProgressBar() self.progressbar.setMinimumWidth(100) self.progressbar.setMinimum(0) self.progressbar.setMaximum(100) self.statusBar().addPermanentWidget(self.progressbar) self.setWindowTitle("SweatTrails") self.setWindowIconText("SweatTrails") icon = QPixmap("image/sweatdrops.png") self.setWindowIcon(QIcon(icon)) QCoreApplication.instance().refresh.connect(self.userSet)
def __init__(self, parent, header, device_settings, firmware_settings, error_codes, *args): QDialog.__init__(self, parent, *args) self.setGeometry(300, 200, 570, 450) self.setWindowTitle("Device information") table_model = DeviceInformationTable(self, header, device_settings) dev_settings_table = QTableView() dev_settings_table.setModel(table_model) table_model = DeviceInformationTable(self, header, firmware_settings) fw_settings_table = QTableView() fw_settings_table.setModel(table_model) table_model = DeviceInformationTable(self, header, error_codes) error_code_table = QTableView() error_code_table.setModel(table_model) # set font # font = QFont("monospace", 10) font = QFont("", 10) dev_settings_table.setFont(font) fw_settings_table.setFont(font) # set column width to fit contents (set font first!) dev_settings_table.resizeColumnsToContents() fw_settings_table.resizeColumnsToContents() error_code_table.resizeColumnsToContents() tab_view = QTabWidget() tab_view.addTab(dev_settings_table, "User settings") tab_view.addTab(fw_settings_table, "Firmware settings") tab_view.addTab(error_code_table, "Error Codes") layout = QVBoxLayout(self) layout.addWidget(tab_view) self.setLayout(layout)
def set_led_count(self, number, colour=Colour.RED, names=None, tips=None, reverse=False, toolTip=True): self._toolTip = toolTip labels = [] for i in range(number): layout = QVBoxLayout() led = WidgetLed(self, colour) label = QLabel(self) label.setAlignment(Qt.AlignHCenter | Qt.AlignTop) layout.addWidget(led) layout.addWidget(label) self._layout.addLayout(layout) self._leds.append(led) labels.append(label) if not reverse: self._leds.reverse() labels.reverse() if names is not None: names.reverse() if tips is not None: tips.reverse() for i in range(number): if names is None: labels[i].setText(str(i)) else: labels[i].setText(names[i]) if tips is not None: self._leds[i].setToolTip(tips[i]) labels[i].setToolTip(tips[i])
def __init__(self, parent=None): # This view is never made visible super(MetadataView, self).__init__() # A container for the controls self._form_container = FormContainer() # A scrollable container for the form self._form_scroll = QScrollArea(parent) self._form_scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self._form_scroll.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) self._form_scroll.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Expanding) self._form_scroll.setWidget(self._form_container) # Make the controls fill the available horizontal space # http://qt-project.org/forums/viewthread/11012 self._form_scroll.setWidgetResizable(True) # Title self._title = QLabel() # Title is fixed at the top - form can be scrolled layout = QVBoxLayout() layout.addWidget(self._title) layout.addWidget(self._form_scroll) # Top-level container for the title and form self.widget = QWidget(parent) self.widget.setLayout(layout)
def __init__(self, *args, **kwargs ): QMainWindow.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setObjectName( Window.objectName ) self.setWindowTitle( Window.title ) mainWidget = QWidget(); self.setCentralWidget( mainWidget ) mainLayout = QVBoxLayout( mainWidget ) addButtonsLayout = QHBoxLayout() buttonAddTab = QPushButton( 'Add Tab' ) buttonAddLine = QPushButton( 'Add Line' ) addButtonsLayout.addWidget( buttonAddTab ) addButtonsLayout.addWidget( buttonAddLine ) tabWidget = TabWidget() self.tabWidget = tabWidget buttonLayout = QHBoxLayout() buttonCreate = QPushButton( "Create" ) buttonClose = QPushButton( "Close" ) buttonLayout.addWidget( buttonCreate ) buttonLayout.addWidget( buttonClose ) mainLayout.addLayout( addButtonsLayout ) mainLayout.addWidget( tabWidget ) mainLayout.addLayout( buttonLayout ) QtCore.QObject.connect( buttonAddTab, QtCore.SIGNAL( 'clicked()' ), partial( self.addTab ) ) QtCore.QObject.connect( buttonAddLine, QtCore.SIGNAL( "clicked()" ), partial( tabWidget.addLine ) ) QtCore.QObject.connect( buttonCreate, QtCore.SIGNAL( "clicked()" ), self.cmd_create ) QtCore.QObject.connect( buttonClose, QtCore.SIGNAL( "clicked()" ), self.cmd_close )
def _setupUi(self): self.setMinimumWidth(800) self.setMinimumHeight(600) layout = QVBoxLayout() self.setLayout(layout) self.editPmCmd = QLineEdit() layout.addWidget(self.editPmCmd) self.modesWidget = QWidget() self.modesLayout = QHBoxLayout() self.modesWidget.setLayout(self.modesLayout) layout.addWidget(self.modesWidget) self.checkBoxes = [] for mode in 'create query edit'.split(): chkBox = QCheckBox(mode) chkBox.setProperty('mode', mode) self.checkBoxes.append(chkBox) for checkBox in self.checkBoxes: self.modesLayout.addWidget(checkBox) checkBox.setChecked(True) if self.command: self.updateDocs() else: layout.addStretch()
def deleteTab(self): dialog = QDialog( self ) dialog.setWindowTitle( "Remove Tab" ) dialog.resize( 300, 50 ) mainLayout = QVBoxLayout(dialog) description = QLabel( "'%s' ���� �����Ͻð� ���ϱ�?".decode('utf-8') % self.tabText( self.currentIndex() ) ) layoutButtons = QHBoxLayout() buttonDelete = QPushButton( "�����".decode('utf-8') ) buttonCancel = QPushButton( "���".decode('utf-8') ) layoutButtons.addWidget( buttonDelete ) layoutButtons.addWidget( buttonCancel ) mainLayout.addWidget( description ) mainLayout.addLayout( layoutButtons ) dialog.show() def cmd_delete(): self.removeTab( self.indexOf( self.currentWidget() ) ) dialog.deleteLater() def cmd_cancel(): dialog.deleteLater() QtCore.QObject.connect( buttonDelete, QtCore.SIGNAL('clicked()'), cmd_delete ) QtCore.QObject.connect( buttonCancel, QtCore.SIGNAL('clicked()'), cmd_cancel )
def __init__(self, parent,silhouette,completeness,homogeneity,v_score,AMI,ARS): QDialog.__init__( self, parent ) layout = QVBoxLayout() viewLayout = QFormLayout() viewLayout.addRow(QLabel('Silhouette score: '),QLabel(silhouette)) viewLayout.addRow(QLabel('Completeness: '),QLabel(completeness)) viewLayout.addRow(QLabel('Homogeneity: '),QLabel(homogeneity)) viewLayout.addRow(QLabel('V score: '),QLabel(v_score)) viewLayout.addRow(QLabel('Adjusted mutual information: '),QLabel(AMI)) viewLayout.addRow(QLabel('Adjusted Rand score: '),QLabel(ARS)) viewWidget = QGroupBox() viewWidget.setLayout(viewLayout) layout.addWidget(viewWidget) #Accept cancel self.acceptButton = QPushButton('Ok') self.cancelButton = QPushButton('Cancel') self.acceptButton.clicked.connect(self.accept) self.cancelButton.clicked.connect(self.reject) hbox = QHBoxLayout() hbox.addWidget(self.acceptButton) hbox.addWidget(self.cancelButton) ac = QWidget() ac.setLayout(hbox) layout.addWidget(ac) self.setLayout(layout)
def _init_widgets(self): layout = QVBoxLayout() # address lbl_addr = QLabel() lbl_addr.setText("Address") txt_addr = QLineEdit() txt_addr.returnPressed.connect(self._on_address_entered) self._txt_addr = txt_addr top_layout = QHBoxLayout() top_layout.addWidget(lbl_addr) top_layout.addWidget(txt_addr) self._view = QMemoryView(self.workspace) area = QScrollArea() self._scrollarea = area area.setVerticalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) area.setWidgetResizable(True) area.setWidget(self._view) layout.addLayout(top_layout) layout.addWidget(area) layout.setContentsMargins(0, 0, 0, 0) self.setLayout(layout)
def __init__(self, parent, remote_indicators_service, title, indicators): super(IndicatorsPanel, self).__init__(parent) self.remote_indicators_service = remote_indicators_service self.month_chooser = MonthChooser(self.MONTHS_STEP) month_before, month_today, month_after = self.month_chooser.navbar_buttons_tuples( ) self.month_chooser.month_changed.connect(self._month_changed) self.set_panel_title(title) self.indicators = indicators vlayout = QVBoxLayout(self) navigation = NavBar(None, [ month_before, month_today, month_after, (_("Recompute"), self._clear_cache), (_("Export to Excel"), self._export_to_excel) ]) self.title_box = TitleWidget( title, self, navigation) # + date.today().strftime("%B %Y"),self) vlayout.addWidget(self.title_box) # Pay attention, subframes holds a reference to each # subframe widget ! ind_layout, self._sub_frames = self._layout_indicators(self.indicators) vlayout.addLayout(ind_layout) self.setLayout(vlayout)
def __init__(self, parent=None): super(AddDialogWidget, self).__init__(parent) nameLabel = QLabel("Name") addressLabel = QLabel("Address") buttonBox = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) self.nameText = QLineEdit() self.addressText = QTextEdit() grid = QGridLayout() grid.setColumnStretch(1, 2) grid.addWidget(nameLabel, 0, 0) grid.addWidget(self.nameText, 0, 1) grid.addWidget(addressLabel, 1, 0, Qt.AlignLeft | Qt.AlignTop) grid.addWidget(self.addressText, 1, 1, Qt.AlignLeft) layout = QVBoxLayout() layout.addLayout(grid) layout.addWidget(buttonBox) self.setLayout(layout) self.setWindowTitle("Add a Contact") buttonBox.accepted.connect(self.accept) buttonBox.rejected.connect(self.reject)
class WallframeAppButton(QWidget): def __init__(self, app_tag, app_image_path, app_description_path): QWidget.__init__(self) #App tag self.app_tag_ = QLabel(app_tag) #App image app_image = QPixmap() app_image.load(app_image_path) self.app_image_ = QLabel() self.app_image_.setPixmap(app_image) #App description try: f = open(app_description_path, 'r') self.app_description_ = f.read() f.close() except: print "Error opening description. Quitting." self.setToolTip(self.app_description_) #Layout the child widgets self.child_layout_ = QVBoxLayout() self.child_layout_.addWidget(self.app_image_) self.child_layout_.addWidget(self.app_tag_) self.setLayout(self.child_layout_)
def __init__(self,parent=None): super(QtReducePreferencesWorksheet,self).__init__(parent) fontGroup = QGroupBox(self.tr("Fonts")) self.fontCombo = QtReduceFontComboBox(self) self.setFocusPolicy(Qt.NoFocus) self.fontCombo.setEditable(False) self.fontCombo.setCurrentFont(self.parent().parent().controller.view.font()) self.sizeCombo = QtReduceFontSizeComboBox() self.sizeComboFs = QtReduceFontSizeComboBoxFs() self.findSizes(self.fontCombo.currentFont()) self.fontCombo.currentFontChanged.connect(self.findSizes) fontLayout = QFormLayout() fontLayout.addRow(self.tr("General Worksheet Font"),self.fontCombo) fontLayout.addRow(self.tr("Font Size"),self.sizeCombo) fontLayout.addRow(self.tr("Full Screen Font Size"),self.sizeComboFs) fontGroup.setLayout(fontLayout) mainLayout = QVBoxLayout() mainLayout.addWidget(fontGroup) self.setLayout(mainLayout)
def __init__(self, title=None): super(TitleWidget, self).__init__() if sys.platform.startswith("darwin"): color1 = QColor(230, 230, 230, 255) color2 = QColor(177, 177, 177, 255) gradient = QLinearGradient() gradient.setStart(0, 0) gradient.setFinalStop(0, TitleWidget.TitleHeight) gradient.setColorAt(0, color1) gradient.setColorAt(1, color2) brush = QBrush(gradient) palette = QPalette() palette.setBrush(QPalette.Background, brush) self.setPalette(palette) self.setAutoFillBackground(True) self.setMaximumHeight(TitleWidget.TitleHeight) self.setMinimumHeight(TitleWidget.TitleHeight) self.titleLabel = QLabel("", parent=self) font = self.titleLabel.font() font.setPixelSize(11) self.titleLabel.setFont(font) self.titleLabel.setAlignment(Qt.AlignCenter) self.titleLabel.setText(title) layout = QVBoxLayout() layout.setSpacing(0) layout.setContentsMargins(0, 0, 0, 0) layout.addWidget(self.titleLabel) self.setLayout(layout)
def _init_widgets(self): # label label = QLabel() label.setText('%#x' % self.path.addr) # the select button path_button = QPushButton() path_button.setText('Select') path_button.released.connect(self._on_path_button_released) # the disasm button disasm_button = QPushButton() disasm_button.setText('Disasm') disasm_button.released.connect(self._on_disasm_button_released) sublayout = QHBoxLayout() sublayout.addWidget(path_button) sublayout.addWidget(disasm_button) layout = QVBoxLayout() layout.addWidget(label) layout.addLayout(sublayout) self.setLayout(layout)
def __init__(self, theScene, parent): """ Default class constructor. :param `theScene`: TOWRITE :type `theScene`: QGraphicsScene :param `parent`: parent widget instance of this dialog. :type `parent`: QWidget """ super(EmbDetailsDialog, self).__init__(parent) self.setMinimumSize(750, 550) self.getInfo() mainWidget = self.createMainWidget() buttonBox = QDialogButtonBox(QDialogButtonBox.Ok) buttonBox.accepted.connect(self.accept) vboxLayoutMain = QVBoxLayout(self) vboxLayoutMain.addWidget(mainWidget) vboxLayoutMain.addWidget(buttonBox) self.setLayout(vboxLayoutMain) self.setWindowTitle(self.tr("Embroidery Design Details")) QApplication.setOverrideCursor(Qt.ArrowCursor)
def __init__(self, folderBrowser): super(MovieList, self).__init__() mainLayout = QVBoxLayout() mainLayout.setContentsMargins(0, 0, 0, 0) self.setLayout(mainLayout) filterLayout = QHBoxLayout() mainLayout.addLayout(filterLayout) self.setWatchedButton = customWidgets.IconButton( "icon_watchList.png", "Set as watched") filterLayout.addWidget(self.setWatchedButton) self.setHideWatchedButton = customWidgets.IconButton( "filter_icon.png", "Set as watched") filterLayout.addWidget(self.setHideWatchedButton) self.filterField = QLineEdit() self.filterField.setObjectName("filterField") filterLayout.addWidget(self.filterField) self.movieList = MovieBrowser(folderBrowser) mainLayout.addWidget(self.movieList) self.progressBar = customWidgets.MyProgress() mainLayout.addWidget(self.progressBar) self.progressBar.setVisible(True) self.setWatchedButton.clicked.connect(self.movieList.setWatched) self.setHideWatchedButton.clicked.connect(self.movieList.hideWatched)
def layoutWidgets(self): hbox = QHBoxLayout() hbox.addWidget(self.indentLabel) hbox.addWidget(self.indentComboBox) hbox.addStretch() self.txtGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.rtfIndentLabel) hbox.addWidget(self.rtfIndentComboBox) hbox.addStretch() self.rtfGroupBox.setLayout(hbox) hbox = QHBoxLayout() hbox.addWidget(self.paperSizeLabel) hbox.addWidget(self.letterRadioButton) hbox.addWidget(self.a4RadioButton) hbox.addStretch() self.pdfGroupBox.setLayout(hbox) vbox = QVBoxLayout() vbox.addWidget(self.rtfGroupBox) vbox.addWidget(self.txtGroupBox) vbox.addWidget(self.pdfGroupBox) vbox.addStretch() self.setLayout(vbox)
def __init__(self, parent, initial_map, tag): """Creates a ColorMap widget. parent The Qt parent of this widget. initial_map The colormap set on creation. tag A name for this widget, will be emitted on change. """ super(ColorMapWidget, self).__init__(parent) self.color_map = initial_map.color_map self.color_map_name = initial_map.color_map_name self.color_step = initial_map.color_step self.step_size = initial_map.step_size self.tag = tag self.color_map_label = "Color Map" self.color_step_label = "Cycle Color Map" self.number_steps_label = "Colors" self.color_step_tooltip = "Use the given number of evenly spaced " \ + " colors from the map and assign to discrete values in cycled " \ + " sequence." layout = QVBoxLayout() layout.addWidget(self.buildColorBarControl()) layout.addItem(QSpacerItem(5,5)) layout.addWidget(self.buildColorStepsControl()) self.setLayout(layout)
class aLabeledPopup(QWidget): def __init__(self, var, text, item_list, pos = "side", max_size = 200): QWidget.__init__(self) self.setContentsMargins(1, 1, 1, 1) if pos == "side": self.layout1=QHBoxLayout() else: self.layout1 = QVBoxLayout() self.layout1.setContentsMargins(1, 1, 1, 1) self.layout1.setSpacing(1) self.setLayout(self.layout1) self.item_combo = QComboBox() self.item_combo.addItems(item_list) self.item_combo.setFont(QFont('SansSerif', 12)) self.label = QLabel(text) # self.label.setAlignment(Qt.AlignLeft) self.label.setFont(QFont('SansSerif', 12)) self.layout1.addWidget(self.label) self.layout1.addWidget(self.item_combo) self.var = var self.item_combo.textChanged.connect(self.when_modified) self.item_combo.currentIndexChanged.connect(self.when_modified) self.when_modified() def when_modified(self): self.var.set(self.item_combo.currentText()) def hide(self): QWidget.hide(self)
def _make_tabs_button(self, side_widgets, side_icons): if len(side_widgets) != len(side_icons): raise Exception( "Bad parameters : len(side_widgets) ({}) != len(side_icons) ({})" .format(len(side_widgets), len(side_icons))) layout = QVBoxLayout() self._side_icons = [] ndx = 0 for w in side_widgets: resource_name = side_icons[ndx] pixmap = QPixmap(os.path.join(resource_dir, resource_name)) icon = QIcon(pixmap) self._side_icons.append(icon) b = QToolButton() b.setIcon(icon) b.setIconSize(pixmap.rect().size()) b.setMaximumWidth(pixmap.rect().width() + 6) b.clicked.connect(self.signal_mapper_tab_changed.map) self.signal_mapper_tab_changed.setMapping(b, ndx) layout.addWidget(b) layout.setStretch(ndx, 1) ndx += 1 layout.addStretch() return layout
def setup_ui(self): """ Setup the UI for the window. """ central_widget = QWidget() layout = QVBoxLayout() layout.addWidget(self.clock_view) layout.addWidget(self.message_view) central_widget.setLayout(layout) self.setCentralWidget(central_widget) menubar = self.menuBar() file_menu = QMenu('File') preferences_action = QAction('Preferences', file_menu) preferences_action.triggered.connect(self.on_preferences_triggered) quit_action = QAction('Quit', file_menu) quit_action.triggered.connect(self.on_quit_triggered) file_menu.addAction(preferences_action) file_menu.addAction(quit_action) menubar.addMenu(file_menu) view_menu = QMenu('View') fullscreen_action = QAction('Fullscreen', view_menu) fullscreen_action.setCheckable(True) fullscreen_action.setChecked(Config.get('FULLSCREEN', True)) fullscreen_action.setShortcut('Ctrl+Meta+F') fullscreen_action.toggled.connect(self.on_fullscreen_changed) view_menu.addAction(fullscreen_action) menubar.addMenu(view_menu)
def __init__(self): super(TransformationHistoryWidget, self).__init__() self.actionContainer = ButtonContainer() self.transformationModel = TransformationModel() self.transformationView = TransformationListView() self.transformationView.setRootIsDecorated(False) self.transformationView.setModel(self.transformationModel) self.transformationView.setAttribute(Qt.WA_MacShowFocusRect, False) self.transformationView.clicked.connect(self.clickedTransformation) self._transformCount = 0 layout = QVBoxLayout() layout.setSpacing(0) layout.setAlignment(Qt.AlignTop) layout.addWidget(self.transformationView) layout.addWidget(self.actionContainer) self.setLayout(layout) removeButton = QPushButton() removeButton.setIcon(QIcon(AppVars.imagePath() + "RemoveButton.png")) removeButton.clicked.connect(self.removeButtonClicked) removeButton.setToolTip("Remove the last transformation") self.actionContainer.addButton(removeButton)
def __init__(self, *args, **kwargs ): QDialog.__init__( self, *args, **kwargs ) self.installEventFilter( self ) self.setWindowTitle( Window.title ) mainLayout = QVBoxLayout( self ) wLabelDescription = QLabel( "Select Object or Group" ) validator = QIntValidator() hLayout = QHBoxLayout() wLabel = QLabel( "Num Controller : " ) wLineEdit= QLineEdit();wLineEdit.setValidator(validator); wLineEdit.setText( '5' ) hLayout.addWidget( wLabel ) hLayout.addWidget( wLineEdit ) button = QPushButton( "Create" ) mainLayout.addWidget( wLabelDescription ) mainLayout.addLayout( hLayout ) mainLayout.addWidget( button ) self.resize(Window.defaultWidth,Window.defaultHeight) self.wlineEdit = wLineEdit QtCore.QObject.connect( button, QtCore.SIGNAL( "clicked()" ), self.cmd_create )