我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QHBoxLayout()。
def __init__ (self, title, mmax=100) : super (FamilyProgress, self).__init__ () self.setWindowTitle (title) self.setFixedHeight (48) self.pbar = QtGui.QProgressBar () self.pbar.setRange (0, mmax - 1) self.btn = QtGui.QPushButton ("Starting", self) pbarvbox = QtGui.QVBoxLayout() pbarvbox.addStretch (False) pbarvbox.addWidget (self.pbar) buttonvbox = QtGui.QVBoxLayout () buttonvbox.addStretch (True) buttonvbox.addWidget (self.btn) hbox = QtGui.QHBoxLayout () hbox.addLayout(pbarvbox, stretch=False) hbox.addLayout(buttonvbox) self.setLayout (hbox) self.pbar.setStyleSheet(START_STYLE) #self.show()
def setupUi(self): """Bruh""" self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setGeometry(50, 50, 600, 300) self.setWindowTitle("ZeZe's TWTools - Backtiming Calculator") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor( QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Main layout & return to main menu button""" self.verticalLayout = QtGui.QVBoxLayout(self) self.buttonLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.buttonLayout) self.returnButton = QtGui.QPushButton(" Return to the Main Menu ", self) self.returnButton.clicked.connect(self.return_function) self.buttonLayout.addWidget(self.returnButton) self.buttonSpacer = QtGui.QSpacerItem(0, 0, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.buttonLayout.addItem(self.buttonSpacer)
def fh(name="horizontal",title=''): w=QtGui.QWidget() #w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ### w.setStyleSheet("QWidget { font: bold 18px;color:blue;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") layout = QtGui.QHBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) w.setLayout(layout) # Gruppenname setzen: #pB= QtGui.QLabel("name") #pB.setStyleSheet("QWidget { font: bold 18px;color:red;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") #layout.addWidget(pB) if title <>'': w.setWindowTitle(title) #w.show() #ComboViewShowWidget(w,False) w.layout=layout return w
def initUI(self, title, idGDT, ContainerOfData): self.idGDT = idGDT self.ContainerOfData = ContainerOfData vbox = QtGui.QVBoxLayout() for widg in self.dd_dialogWidgets: if widg <> None: w = widg.generateWidget(self.idGDT,self.ContainerOfData) if isinstance(w, QtGui.QLayout): vbox.addLayout( w ) else: vbox.addWidget( w ) hbox = QtGui.QHBoxLayout() buttonCreate = QtGui.QPushButton(title) buttonCreate.setDefault(True) buttonCreate.clicked.connect(self.createObject) hbox.addStretch(1) hbox.addWidget( buttonCreate ) hbox.addStretch(1) vbox.addLayout( hbox ) self.setLayout(vbox)
def __init__(self, filename=None, parent=None): dialogMAIN_FORM.__init__(self, parent) self.databaseType = "razen" ### self.generateLayers() self.spisWarstw.sortItems(1) # self.razenBiblioteki = QtGui.QLineEdit('') if PCBconf.supSoftware[self.databaseType]['libPath'] != "": self.razenBiblioteki.setText(PCBconf.supSoftware[self.databaseType]['libPath']) lay = QtGui.QHBoxLayout() lay.addWidget(QtGui.QLabel('Library')) lay.addWidget(self.razenBiblioteki) self.lay.addLayout(lay, 12, 0, 1, 6)
def __init__(self, filename=None, parent=None): dialogMAIN_FORM.__init__(self, parent) self.databaseType = "fidocadj" self.projektBRD = __builtin__.open(filename, "r").read().replace("\r", "") self.layersNames = {} self.getLayersNames() #### self.generateLayers() self.spisWarstw.sortItems(1) # self.fidocadjBiblioteki = QtGui.QLineEdit('') if PCBconf.supSoftware[self.databaseType]['libPath'] != "": self.fidocadjBiblioteki.setText(PCBconf.supSoftware[self.databaseType]['libPath']) lay = QtGui.QHBoxLayout() lay.addWidget(QtGui.QLabel('Library')) lay.addWidget(self.fidocadjBiblioteki) self.lay.addLayout(lay, 12, 0, 1, 6)
def MaintainLayout(self): self.InterfaceWidget =QtGui.QWidget() self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceLayout = QtGui.QVBoxLayout() ConsensusPlot = QtGui.QHBoxLayout() # self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) # self.communitiesAcrossTimeStep.PlotWidget.setMinimumSize(200,100) # self.communitiesAcrossTimeStep.PlotWidget.setMaximumSize(200,100) # ConsensusPlot.addWidget(self.communitiesAcrossTimeStep.PlotWidget) self.InterfaceLayout.addWidget(self.Visualizer.MainTab) self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) self.InterfaceLayout.addLayout(ConsensusPlot) self.InterfaceLayout.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.setLayout(self.InterfaceLayout) self.InterfaceWidget.setContentsMargins(0, 0, 0, 0) self.InterfaceWidget.show() # def connectCustomWebView(self, view): # self.view = view # self.Visualizer.SliceInterval.valueChanged[int].connect(self.view.slicesChanged)
def create_setting(self, name): setting = self.get_setting(name) if setting.type == 'string': return self.create_text_input_setting(name) elif setting.type == 'strings': return self.create_text_input_setting(name) elif setting.type == 'file': return self.create_text_input_with_file_setting(name) elif setting.type == 'folder': return self.create_text_input_with_folder_setting(name) elif setting.type == 'check': return self.create_check_setting(name) elif setting.type == 'list': return self.create_list_setting(name) elif setting.type == 'range': return self.create_range_setting(name) elif setting.type == 'color': return self.create_color_setting(name) else: print('Setting "{}" type "{}" not defined.'.format(name, setting.type)) return QtGui.QHBoxLayout()
def create_check_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) check = QtGui.QCheckBox() check.setObjectName(setting.name) check.clicked.connect(self.call_with_object('setting_changed', check, setting)) check.setChecked(setting.value) check.setStatusTip(setting.description) check.setToolTip(setting.description) hlayout.addWidget(check) return hlayout
def createNodeMenu(self): menuEntry = QtGui.QGraphicsWidget() menuEntryLayout = QtGui.QHBoxLayout() menuEntry.setLayout(menuEntryLayout) menuEntry.setGeometry(0,0,100,100) menuEntryTextField = QtGui.QLineEdit() menuEntryLayout.addWidget(menuEntryTextField) menu = QtGui.QMenu("Create Node") menu.addAction("Node1") menu.addAction("Node2") menu.popup(QtGui.QCursor.pos()) menu.setZValue(100000) print "Menu"
def __init__(self): super(HeaderParameterPanel,self).__init__() layout = QtGui.QHBoxLayout() self.setLayout(layout) self.nodeTypeLabel = QtGui.QLabel("<NodeDefaultType>") self.nodeNameField = QtGui.QLineEdit("<NodeDefaultName>") self.lockButton = QtGui.QPushButton("L") self.editInterfaceButton = QtGui.QPushButton("G") layout.addWidget(self.nodeTypeLabel) layout.addWidget(self.nodeNameField) layout.addWidget(self.lockButton) layout.addWidget(self.editInterfaceButton) # This is the graphical aspect of the ParameterTemplate
def initUI(self): self._layout = QtGui.QHBoxLayout() self.setLayout(self._layout) self._layout.setContentsMargins(10,0,10,10) self._layout.setSpacing(5) self._tabs = QtGui.QTabBar() #self._tabs.setTabsClosable(True) self._tabs.addTab("Tab1") self._tabs.addTab("Tab2") self._tabs.addTab("Tab3") icnPath = "/Users/draknova/Documents/workspace/sPipe/bin/images/icons" addIcone = QtGui.QIcon(QtGui.QPixmap("%s/add.png"%(icnPath))) panelIcone = QtGui.QIcon(QtGui.QPixmap("%s/list.png"%(icnPath))) self._addButton = QtGui.QPushButton(addIcone,"") self._panelButton = QtGui.QPushButton(panelIcone,"") self._layout.addWidget(self._tabs) self._layout.addWidget(self._addButton) self._layout.addStretch() self._layout.addWidget(self._panelButton)
def __init__(self, *args,**kwargs): super(MainWidget, self).__init__(*args,**kwargs) self.setLayout(QtGui.QHBoxLayout()) self.bkg_wdgt = QtGui.QWidget() self.layout().addWidget(self.bkg_wdgt) self.bkg_wdgt.setLayout(QtGui.QHBoxLayout()) self.btn = QtGui.QPushButton("hallo") self.textarea = QtGui.QTextEdit() self.bkg_wdgt.layout().addWidget(self.btn) self.bkg_wdgt.layout().addWidget(self.textarea) self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.btn.clicked.connect(self.on_btn_clicked) # self.parent_hwnd = None
def __init__(self, *args): QtWidgets.QFrame.__init__(self, *args) self.setFrameStyle(QtWidgets.QFrame.StyledPanel | QtWidgets.QFrame.Sunken) self.edit = self.PlainTextEdit() self.number_bar = self.NumberBar(self.edit) hbox = QtWidgets.QHBoxLayout(self) hbox.setSpacing(0) hbox.setContentsMargins(0,0,0,0) # setMargin hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjustWidth) self.edit.updateRequest.connect(self.number_bar.updateContents)
def quickLayout(self, type, ui_name=""): the_layout = '' if type in ("form", "QFormLayout"): the_layout = QtWidgets.QFormLayout() the_layout.setLabelAlignment(QtCore.Qt.AlignLeft) the_layout.setFieldGrowthPolicy(QtWidgets.QFormLayout.AllNonFixedFieldsGrow) elif type in ("grid", "QGridLayout"): the_layout = QtWidgets.QGridLayout() elif type in ("hbox", "QHBoxLayout"): the_layout = QtWidgets.QHBoxLayout() the_layout.setAlignment(QtCore.Qt.AlignTop) else: the_layout = QtWidgets.QVBoxLayout() the_layout.setAlignment(QtCore.Qt.AlignTop) if ui_name != "": self.uiList[ui_name] = the_layout return the_layout
def __init__(self, *args): QtGui.QFrame.__init__(self, *args) self.setFrameStyle(QtGui.QFrame.StyledPanel | QtGui.QFrame.Sunken) self.edit = self.PlainTextEdit() self.number_bar = self.NumberBar(self.edit) hbox = QtGui.QHBoxLayout(self) hbox.setSpacing(0) hbox.setContentsMargins(0,0,0,0) # setMargin hbox.addWidget(self.number_bar) hbox.addWidget(self.edit) self.edit.blockCountChanged.connect(self.number_bar.adjustWidth) self.edit.updateRequest.connect(self.number_bar.updateContents)
def createIconGroupBox(self): self.iconGroupBox = QtGui.QGroupBox("Tray Icon") self.iconLabel = QtGui.QLabel("Icon:") self.iconComboBox = QtGui.QComboBox() self.iconComboBox.addItem(QtGui.QIcon(':/icons/miner.svg'), "Miner") self.iconComboBox.addItem(QtGui.QIcon(':/images/heart.svg'), "Heart") self.iconComboBox.addItem(QtGui.QIcon(':/images/trash.svg'), "Trash") self.showIconCheckBox = QtGui.QCheckBox("Show icon") self.showIconCheckBox.setChecked(True) iconLayout = QtGui.QHBoxLayout() iconLayout.addWidget(self.iconLabel) iconLayout.addWidget(self.iconComboBox) iconLayout.addStretch() iconLayout.addWidget(self.showIconCheckBox) self.iconGroupBox.setLayout(iconLayout)
def init_tree_widget(self): # Add part buttons h_box = QtGui.QHBoxLayout(self.tree_widget) add_parts_button = QtGui.QPushButton('Add parts', self.tree_widget) add_parts_button.clicked.connect(self.add_parts) add_same_part_button = QtGui.QPushButton('Add same parts', self.tree_widget) add_same_part_button.clicked.connect(self.add_same_parts) h_box.addWidget(add_parts_button) h_box.addWidget(add_same_part_button) self.tree_vbox.addLayout(h_box) # tree self.selection_model = self.tree_view_widget.selectionModel() self.selection_model.selectionChanged.connect(self.selection_changed) self.tree_vbox.addWidget(self.tree_view_widget) remove_item_button = QtGui.QPushButton('Remove item', self.tree_widget) remove_item_button.clicked.connect(self.remove_items) self.tree_vbox.addWidget(remove_item_button) # test layout self.edit_items_layout = QtGui.QVBoxLayout(self.tree_widget) self.tree_vbox.addLayout(self.edit_items_layout)
def init_middle_pane(self): self.mid_pane = QtGui.QHBoxLayout() # IMGS: images which will display the video preview pixmap = QtGui.QPixmap("0.jpg") pixmap.scaledToWidth(self.preview_size) pixmap.scaledToHeight(self.preview_size) img_lbl = QtGui.QLabel(self) img_lbl.setPixmap(pixmap) # Make sure the window isn't constantly resizing img_lbl.setScaledContents(True) img_lbl.setMaximumWidth(self.preview_size) img_lbl.setMaximumHeight(self.preview_size) self.img = img_lbl self.mid_pane.addWidget(self.img) # SLIDER: slide to rate the quality of the video self.slider = QtGui.QSlider(self, QtCore.Qt.Vertical) self.slider.setTickPosition(QtGui.QSlider.TicksBothSides) self.slider.setTickInterval(20) self.mid_pane.addWidget(self.slider) self.layout.addLayout(self.mid_pane)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.horizontalLayout = QtGui.QHBoxLayout(Form) self.horizontalLayout.setObjectName("horizontalLayout") self.tableLayout = QtGui.QVBoxLayout() self.tableLayout.setObjectName("tableLayout") self.horizontalLayout.addLayout(self.tableLayout) self.verticalLayout = QtGui.QVBoxLayout() self.verticalLayout.setObjectName("verticalLayout") self.addAttr_btn = QtGui.QPushButton(Form) self.addAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.addAttr_btn.setObjectName("addAttr_btn") self.verticalLayout.addWidget(self.addAttr_btn) self.removeAttr_btn = QtGui.QPushButton(Form) self.removeAttr_btn.setMaximumSize(QtCore.QSize(30, 16777215)) self.removeAttr_btn.setObjectName("removeAttr_btn") self.verticalLayout.addWidget(self.removeAttr_btn) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.verticalLayout.addItem(spacerItem) self.horizontalLayout.addLayout(self.verticalLayout) self.horizontalLayout.setStretch(0, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def setupUi(self, onionSkinObject_layout): onionSkinObject_layout.setObjectName("onionSkinObject_layout") onionSkinObject_layout.resize(204, 38) self.horizontalLayout = QtGui.QHBoxLayout(onionSkinObject_layout) self.horizontalLayout.setSpacing(3) self.horizontalLayout.setContentsMargins(4, 2, 4, 2) self.horizontalLayout.setObjectName("horizontalLayout") self.object_label = QtGui.QLabel(onionSkinObject_layout) self.object_label.setObjectName("object_label") self.horizontalLayout.addWidget(self.object_label) self.object_remove_btn = QtGui.QPushButton(onionSkinObject_layout) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.object_remove_btn.sizePolicy().hasHeightForWidth()) self.object_remove_btn.setSizePolicy(sizePolicy) self.object_remove_btn.setMinimumSize(QtCore.QSize(16, 16)) self.object_remove_btn.setMaximumSize(QtCore.QSize(16, 16)) self.object_remove_btn.setObjectName("object_remove_btn") self.horizontalLayout.addWidget(self.object_remove_btn) self.retranslateUi(onionSkinObject_layout) QtCore.QMetaObject.connectSlotsByName(onionSkinObject_layout)
def splitter(self): self.vis_3d = Vis3D() self.vis_instrument = VisInstrument() self.vis_sensors = VisSensors() hbox = QtGui.QHBoxLayout(self) splitter1 = QtGui.QSplitter(QtCore.Qt.Horizontal) splitter1.addWidget(self.vis_3d) splitter1.addWidget(self.vis_instrument) splitter1.setSizes([800, 200]) splitter2 = QtGui.QSplitter(QtCore.Qt.Vertical) splitter2.addWidget(splitter1) splitter2.addWidget(self.vis_sensors) splitter2.setSizes([400, 200]) hbox.addWidget(splitter2) self.setLayout(hbox)
def __init__(self, unitGroup, field_type=int): super(UnitLineEdit, self).__init__() self.unit_idx = 0 self._value = 0 self._field_type = float self.layout = QtGui.QHBoxLayout() self.layout.setContentsMargins(0,0,0,0) self.__lineEdit = PLineEdit() self.__lineEdit.editingFinished.connect(self.text_changed) self.__unitDropDown = QtGui.QComboBox() self.__unitDropDown.currentIndexChanged.connect(self.indexChanged) self._placeholder_value = None self.setLayout(self.layout) self.layout.addWidget(self.__lineEdit, 0) self.layout.addWidget(self.__unitDropDown, 1) self.setUnitGroup(unitGroup)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(224, 117) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Preferred, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(Form.sizePolicy().hasHeightForWidth()) Form.setSizePolicy(sizePolicy) self.verticalLayout = QtGui.QVBoxLayout(Form) self.verticalLayout.setSpacing(1) self.verticalLayout.setContentsMargins(0, 0, 0, 0) self.verticalLayout.setObjectName("verticalLayout") self.translateLabel = QtGui.QLabel(Form) self.translateLabel.setObjectName("translateLabel") self.verticalLayout.addWidget(self.translateLabel) self.rotateLabel = QtGui.QLabel(Form) self.rotateLabel.setObjectName("rotateLabel") self.verticalLayout.addWidget(self.rotateLabel) self.scaleLabel = QtGui.QLabel(Form) self.scaleLabel.setObjectName("scaleLabel") self.verticalLayout.addWidget(self.scaleLabel) self.horizontalLayout = QtGui.QHBoxLayout() self.horizontalLayout.setObjectName("horizontalLayout") self.mirrorImageBtn = QtGui.QPushButton(Form) self.mirrorImageBtn.setToolTip("") self.mirrorImageBtn.setObjectName("mirrorImageBtn") self.horizontalLayout.addWidget(self.mirrorImageBtn) self.reflectImageBtn = QtGui.QPushButton(Form) self.reflectImageBtn.setObjectName("reflectImageBtn") self.horizontalLayout.addWidget(self.reflectImageBtn) self.verticalLayout.addLayout(self.horizontalLayout) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
def __init__(self, parent=None): super(self.__class__, self).__init__(parent=parent) self.setupUi(self) self.horizontalLayout = QtGui.QHBoxLayout(self.buttonLabel) self.horizontalLayout.setContentsMargins(0, 0, 0, 0) self.toolButton = QtGui.QToolButton(self) self.toolButton.setAutoRaise(True) self.toolButton.setArrowType(QtCore.Qt.DownArrow) self.horizontalLayout.addWidget(self.toolButton)
def setupUi(self): """Bruh""" self.setGeometry(50, 50, 450, 250) self.setWindowTitle("ZeZe's TWTools - Updating Servers") self.setWindowIcon(QtGui.QIcon(resource_path("images/icon.png"))) """Background color""" self.backgroundPalette = QtGui.QPalette() self.backgroundColor = QtGui.QColor(217, 204, 170) self.backgroundPalette.setColor(QtGui.QPalette.Background, self.backgroundColor) self.setPalette(self.backgroundPalette) """Layout""" self.verticalLayout = QtGui.QVBoxLayout(self) self.text = QtGui.QLabel("Updating server list:") self.verticalLayout.addWidget(self.text) """Download bar""" self.progress_bar = QtGui.QProgressBar(self) self.progress_bar.setMinimum(0) self.progress_bar.setMaximum(27) self.progress_bar.setValue(0) self.progress_bar.setFormat("%v / %m") self.verticalLayout.addWidget(self.progress_bar) """Text browser for progress""" self.progress_text = QtGui.QTextBrowser(self) self.verticalLayout.addWidget(self.progress_text) """Button""" self.horizontalLayout = QtGui.QHBoxLayout(self) self.verticalLayout.addLayout(self.horizontalLayout) self.Spacer = QtGui.QSpacerItem(40, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum) self.horizontalLayout.addItem(self.Spacer) self.cancelButton = QtGui.QPushButton("Cancel") self.horizontalLayout.addWidget(self.cancelButton) self.cancelButton.clicked.connect(self.cancel_function)
def setupUi(self, MainWindow): """Setting up UI for Main Window """ MainWindow.setObjectName("MainWindow") MainWindow.resize(804, 600) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName("centralwidget") self.horizontalLayout = QtGui.QHBoxLayout(self.centralwidget) self.horizontalLayout.setObjectName("horizontalLayout") self.txtInput = QtGui.QPlainTextEdit(self.centralwidget) self.txtInput.setObjectName("MarkDtextEdit") self.horizontalLayout.addWidget(self.txtInput) self.txtOutput = QtGui.QTextEdit(self.centralwidget) self.txtOutput.setObjectName("MarkDownView") self.horizontalLayout.addWidget(self.txtOutput) MainWindow.setCentralWidget(self.centralwidget) self.menubar = QtGui.QMenuBar(MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 804, 21)) self.menubar.setObjectName("menubar") MainWindow.setMenuBar(self.menubar) self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) self.retranslateUi(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
def GDTDialog_hbox( label, inputWidget): hbox = QtGui.QHBoxLayout() hbox.addWidget( QtGui.QLabel(label) ) if inputWidget <> None: hbox.addStretch(1) hbox.addWidget(inputWidget) return hbox
def generateWidget( self, idGDT, ContainerOfData ): self.idGDT = idGDT self.ContainerOfData = ContainerOfData self.checkBox = QtGui.QCheckBox(self.Text) self.checkBox.setChecked(True) global checkBoxState checkBoxState = True hbox = QtGui.QHBoxLayout() hbox.addWidget(self.checkBox) hbox.addStretch(1) self.checkBox.stateChanged.connect(self.updateState) return hbox
def setupUi(self, type_widget): type_widget.setObjectName("type_widget") type_widget.resize(248, 78) self.horizontalLayout_2 = QtGui.QHBoxLayout(type_widget) self.horizontalLayout_2.setObjectName("horizontalLayout_2") self.type_icon = QtGui.QLabel(type_widget) sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Preferred) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.type_icon.sizePolicy().hasHeightForWidth()) self.type_icon.setSizePolicy(sizePolicy) self.type_icon.setObjectName("type_icon") self.horizontalLayout_2.addWidget(self.type_icon) spacerItem = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem) self.line = QtGui.QFrame(type_widget) self.line.setFrameShape(QtGui.QFrame.VLine) self.line.setFrameShadow(QtGui.QFrame.Sunken) self.line.setObjectName("line") self.horizontalLayout_2.addWidget(self.line) spacerItem1 = QtGui.QSpacerItem(20, 20, QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Minimum) self.horizontalLayout_2.addItem(spacerItem1) self.type_label = QtGui.QLabel(type_widget) font = QtGui.QFont() font.setFamily("Cantarell") font.setPointSize(10) font.setWeight(75) font.setBold(True) self.type_label.setFont(font) self.type_label.setObjectName("type_label") self.horizontalLayout_2.addWidget(self.type_label) self.retranslateUi(type_widget) QtCore.QMetaObject.connectSlotsByName(type_widget)
def setupUi(self): self.setAutoFillBackground(True) hLayout = QtGui.QHBoxLayout(self) self.setLayout(hLayout) self.taskNameWidget = QtGui.QLineEdit(self.task.name) self.priorityWidget = PriorityWidget() self.priorityWidget.setValue(self.task.priority) self.statusWidget = StatusWidgetBar() self.statusWidget.setCurrentIndex(self.task.status) self.deleteWidget = DeleteWidget('delete') hLayout.addWidget(self.taskNameWidget) hLayout.addWidget(self.priorityWidget) hLayout.addWidget(self.statusWidget) hLayout.addWidget(self.deleteWidget)
def setupUI(self): mainLayout = QtGui.QVBoxLayout() self.setLayout(mainLayout) self.buttonLayout = QtGui.QHBoxLayout() self.msg = QtGui.QLabel() self.addTaskButton = QtGui.QPushButton('Add Task') self.addTaskButton.setToolTip('Add a new task to the list') self.sortButton = QtGui.QPushButton('Reverse Sorting') self.sortButton.setCheckable(True) self.sortButton.setToolTip('Push to sort so highest priorities are at the top,\notherwise lowest will be at the top.') self.helpButton = QtGui.QPushButton('?') self.helpButton.setMaximumWidth(30) self.helpButton.setFlat(True) self.helpButton.setToolTip(self.__helpText()) self.hideButton = QtGui.QPushButton('Hide Finished Tasks') self.hideButton.setCheckable(True) self.hideButton.setToolTip('Hide finished tasks to keep the list tidy') self.clipboardButton = QtGui.QPushButton('Copy To Clipboard') self.clipboardButton.setToolTip('Push to copy current task info to cliboard for pasting into emails or other text documents.\nHandy to keep those coordinators happy.') self.buttonLayout.addWidget(self.addTaskButton) self.buttonLayout.addWidget(self.sortButton) self.buttonLayout.addWidget(self.hideButton) self.buttonLayout.addWidget(self.clipboardButton) self.buttonLayout.addSpacing(20) self.buttonLayout.addWidget(self.helpButton) self.layout().addWidget(self.msg) self.layout().addLayout(self.buttonLayout) self.taskContainer = QtGui.QWidget() self.scrollArea = QtGui.QScrollArea() self.scrollArea.setWidget(self.taskContainer) self.layout().addWidget(self.scrollArea) self.createTaskWidgets() self.update()
def __init__(self, templateData, parcelationData, axis, correlationTable, colorTable, selectedColor): super(SliceViewer, self).__init__() self.template = templateData self.regionId = None self.parcelation = parcelationData self.axis = axis self.CommunityMode = False self.correlationTable = correlationTable self.colorTable= colorTable self.selectedColor = selectedColor self.displayedSlice = 0 self.QImage = [] scalefactor = 350 self.scaleFactor = int(math.ceil(scalefactor / self.parcelation.shape[0])) numColors = self.parcelation.max() self.clut = np.zeros(numColors, dtype=np.uint32) for i in range(numColors): r, g, b = colorsys.hls_to_rgb(float(i) / float(numColors), 0.5, 1.0) self.clut[i] = (255 << 24 | int(255*r) << 16 | int(255*g) << 8 | int(255*b)) slice_view_layout = QtGui.QHBoxLayout() self.setLayout(slice_view_layout) slider = QtGui.QSlider() slider.setRange(0, self.template.shape[self.axis]-1) slider.valueChanged.connect(self.setDisplayedSlice) slider.sliderReleased.connect(self.handleSliderRelease) slider.setValue(self.displayedSlice) slice_view_layout.addWidget(slider) self.label = QtGui.QLabel() self.updateSliceLabel() slice_view_layout.addWidget(self.label)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None): super(XrefDialogClass, self).__init__(parent) self.current_class = current_class self.class_analysis = class_analysis title = "Xrefs for the class %s" % current_class self.setWindowTitle(title) xrefs_list = [] ref_kind_map = {0:"Class instanciation", 1:"Class reference"} xrefs_from = class_analysis.get_xref_from() for ref_class in xrefs_from: for ref_kind, ref_method in xrefs_from[ref_class]: xrefs_list.append(('From', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class())) xrefs_to = class_analysis.get_xref_to() for ref_class in xrefs_to: for ref_kind, ref_method in xrefs_to[ref_class]: xrefs_list.append(('To', ref_kind_map[ref_kind], ref_method, ref_class.get_vm_class())) closeButton = QtGui.QPushButton("Close") closeButton.clicked.connect(self.close) xreflayout = QtGui.QGridLayout() xrefwin = XrefListView(self, win=win, xrefs=xrefs_list, headers=["Origin", "Kind", "Method"]) xreflayout.addWidget(xrefwin, 0, 0) buttonsLayout = QtGui.QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(xreflayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, method_analysis=None): super(XrefDialogMethod, self).__init__(parent) self.current_class = current_class self.class_analysis = class_analysis self.method_analysis = method_analysis title = "Xrefs for the method %s" % self.method_analysis.method self.setWindowTitle(title) xrefs_list = [] xrefs_from = self.method_analysis.get_xref_from() for ref_class, ref_method in xrefs_from: xrefs_list.append(('From', ref_method, ref_class.get_vm_class())) xrefs_to = self.method_analysis.get_xref_to() for ref_class, ref_method in xrefs_to: xrefs_list.append(('To', ref_method, ref_class.get_vm_class())) closeButton = QtGui.QPushButton("Close") closeButton.clicked.connect(self.close) xreflayout = QtGui.QGridLayout() xrefwin = XrefListView(self, win=win, xrefs=xrefs_list) xreflayout.addWidget(xrefwin, 0, 0) buttonsLayout = QtGui.QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(xreflayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, current_class=None, class_analysis=None, field_analysis=None): super(XrefDialogField, self).__init__(parent) self.current_class = current_class self.class_analysis = class_analysis self.field_analysis = field_analysis title = "Xrefs for the field %s" % self.field_analysis.field self.setWindowTitle(title) xrefs_list = [] xrefs_read = self.field_analysis.get_xref_read() for ref_class, ref_method in xrefs_read: xrefs_list.append(('Read', ref_method, ref_class.get_vm_class())) xrefs_write = self.field_analysis.get_xref_write() for ref_class, ref_method in xrefs_write: xrefs_list.append(('Write', ref_method, ref_class.get_vm_class())) closeButton = QtGui.QPushButton("Close") closeButton.clicked.connect(self.close) xreflayout = QtGui.QGridLayout() xrefwin = XrefListView(self, win=win, xrefs=xrefs_list) xreflayout.addWidget(xrefwin, 0, 0) buttonsLayout = QtGui.QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(xreflayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout)
def __init__(self, parent=None, win=None, string_analysis=None): super(XrefDialogString, self).__init__(parent) self.string_analysis = string_analysis title = "Xrefs for the string %s" % self.string_analysis.value self.setWindowTitle(title) xrefs_list = [] xrefs_from = self.string_analysis.get_xref_from() for ref_class, ref_method in xrefs_from: xrefs_list.append(('From', ref_method, ref_class.get_vm_class())) closeButton = QtGui.QPushButton("Close") closeButton.clicked.connect(self.close) xreflayout = QtGui.QGridLayout() xrefwin = XrefListView(self, win=win, xrefs=xrefs_list) xreflayout.addWidget(xrefwin, 0, 0) buttonsLayout = QtGui.QHBoxLayout() buttonsLayout.addStretch(1) buttonsLayout.addWidget(closeButton) mainLayout = QtGui.QVBoxLayout() mainLayout.addLayout(xreflayout) mainLayout.addLayout(buttonsLayout) self.setLayout(mainLayout)
def create_directory_choose(self): group_box = QtGui.QGroupBox('An awesome web project called:') title_hbox = QHBoxLayout() title_hbox.setContentsMargins(10, 10, 10, 10) win_icon = self.create_icon_box('window_icon', 'Window Icon') exe_icon = self.create_icon_box('exe_icon', 'Exe Icon') mac_icon = self.create_icon_box('mac_icon', 'Mac Icon') self.title_label = QtGui.QLabel('TBD') self.title_label.setStyleSheet('font-size:20px; font-weight:bold;') title_hbox.addWidget(self.title_label) title_hbox.addWidget(QtGui.QLabel()) title_hbox.addWidget(win_icon) title_hbox.addWidget(exe_icon) title_hbox.addWidget(mac_icon) vlayout = QtGui.QVBoxLayout() vlayout.setSpacing(5) vlayout.setContentsMargins(10, 5, 10, 5) vlayout.addLayout(title_hbox) #vlayout.addLayout(input_layout) #vlayout.addLayout(output_layout) group_box.setLayout(vlayout) return group_box
def create_text_input_with_file_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) text = QtGui.QLineEdit() text.setObjectName(setting.name) button = QtGui.QPushButton('...') button.setMaximumWidth(30) button.setMaximumHeight(26) button.clicked.connect(self.call_with_object('get_file', button, text, setting)) if setting.value: text.setText(setting.value) text.setStatusTip(setting.description) text.setToolTip(setting.description) text.textChanged.connect(self.call_with_object('setting_changed', text, setting)) hlayout.addWidget(text) hlayout.addWidget(button) return hlayout
def create_color_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) color_disp = ColorDisplay(setting.value or setting.default_value) color_disp.setObjectName(setting.name) color_disp.setContentsMargins(5, 5, 5, 5) button = QtGui.QPushButton('Choose...') button.setMaximumWidth(100) button.setMaximumHeight(26) button.clicked.connect(self.call_with_object('get_color', button, color_disp, setting.value or setting.default_value, setting)) if setting.value: color_disp.setColor(setting.value) color_disp.setStatusTip(setting.description) color_disp.setToolTip(setting.description) color_disp.colorChanged.connect(self.call_with_object('setting_changed', color_disp, setting)) hlayout.addWidget(color_disp) hlayout.addWidget(button) return hlayout
def create_text_input_with_folder_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) text = QtGui.QLineEdit() text.setObjectName(setting.name) button = QtGui.QPushButton('...') button.setMaximumWidth(30) button.setMaximumHeight(26) button.clicked.connect(self.call_with_object('get_folder', button, text, setting)) if setting.value: text.setText(setting.value) text.setStatusTip(setting.description) text.setToolTip(setting.description) text.textChanged.connect(self.call_with_object('setting_changed', text, setting)) hlayout.addWidget(text) hlayout.addWidget(button) return hlayout
def create_list_setting(self, name): hlayout = QtGui.QHBoxLayout() setting = self.get_setting(name) button = None if setting.button: button = QtGui.QPushButton(setting.button) button.clicked.connect(lambda: setting.button_callback(button)) combo = QtGui.QComboBox() combo.setObjectName(setting.name) combo.currentIndexChanged.connect(self.call_with_object('setting_changed', combo, setting)) combo.editTextChanged.connect(self.call_with_object('setting_changed', combo, setting)) combo.setStatusTip(setting.description) combo.setToolTip(setting.description) for val in setting.values: combo.addItem(val) default_index = combo.findText(setting.default_value) if default_index != -1: combo.setCurrentIndex(default_index) hlayout.addWidget(QtGui.QLabel()) hlayout.addWidget(combo) if button: hlayout.addWidget(button) return hlayout
def initUI(self): self._layout = QtGui.QGridLayout(None) self.setLayout(self._layout) self._layout.setContentsMargins(0,5,0,5) self._layout.setSpacing(0) self._topBar = QtGui.QFrame() self._topBarLayout = QtGui.QHBoxLayout(self._topBar) self._refreshProgression = QtGui.QProgressBar() self._refreshProgression.setMinimum(0) self._refreshProgression.setMaximum(100) self._refreshProgression.setValue(10) self._refreshButton = QtGui.QPushButton("Refresh") self._filterLabel = QtGui.QLabel("Filter :") self._filterField = QtGui.QLineEdit() self._topBarLayout.addWidget(self._refreshProgression) self._topBarLayout.addWidget(self._refreshButton) self._topBarLayout.addWidget(self._filterLabel) self._topBarLayout.addWidget(self._filterField) self.generateJobList() self._layout.addWidget(self._topBar) self._layout.addWidget(self._jobList) self._autoRefresh = JobListAutoRefresh(self,self._refreshProgression) #autoRefresh.run() self._refreshButton.clicked.connect(self.startRefresh)
def initUI(self): # Define Layout self._layout = QtGui.QHBoxLayout() self._layout.setContentsMargins(0,0,0,0) self._layout.setSpacing(5) self.setLayout(self._layout) # Create Elements self._label = QtGui.QPushButton(self._parameter.label()) self._field = QtGui.QLineEdit(str(self._parameter.value())) self._slider = ParameterSlider() self._layout.addWidget(self._label) self._layout.addWidget(self._field) self._layout.addWidget(self._slider)
def initUI(self): self._mainLayout = QtGui.QHBoxLayout(self) self.setLayout(self._mainLayout) self.parmTypeList = ParameterTypeList(self) self.parmTempList = ParameterTemplateList(self) self._mainLayout.addWidget(self.parmTypeList) self._mainLayout.addWidget(self.parmTempList)