我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QPushButton()。
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 setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtGui.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
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 main(): #MaxPlus.FileManager.Reset(True) w = QtGui.QWidget() MaxPlus.AttachQWidgetToMax(w) if _GCProtector.widgets : w = _GCProtector.widgets print w w.resize(250, 100) w.setWindowTitle('Window') _GCProtector.widgets = w w.show() main_layout = QtGui.QVBoxLayout() label = QtGui.QLabel("Click button to create a cylinder in the scene") main_layout.addWidget(label) cylinder_btn = QtGui.QPushButton("Cylinder") main_layout.addWidget(cylinder_btn) w.setLayout(main_layout) cylinder_btn.clicked.connect(make_cylinder)
def __init__(self): super(MatcherUI, self).__init__() self.setWindowTitle("Matcher") self.resize(230, 180) self.layout = QtGui.QVBoxLayout(self) label = QtGui.QLabel("Match attributes\nbetween objects") separator = HSeparator() self.name = QtGui.QCheckBox("Name") self.color = QtGui.QCheckBox("Color") self.position = QtGui.QCheckBox("Position") self.rotation = QtGui.QCheckBox("Rotation") self.ref = QtGui.QCheckBox("Ref") separator2 = HSeparator() self.button = QtGui.QPushButton("Apply") self.layout.addWidget(label) self.layout.addWidget(separator) self.layout.addWidget(self.name) self.layout.addWidget(self.color) self.layout.addWidget(self.position) self.layout.addWidget(self.rotation) self.layout.addWidget(self.ref) self.layout.addWidget(separator2) self.layout.addWidget(self.button)
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 select_element(self, element): """ Show an element as selected. """ widget = self._get_element_widget(element) widget.setStyleSheet("QPushButton { font-weight: bold; }") if self.multiple_select: self._selected_elements.append(element) self.btn_ok.setEnabled(True) else: self._selected_elements = [element] if self.close_on_first_select: self.close() return None
def deselect_element(self, element): """ Show an element as being de-selected. """ widget = self._get_element_widget(element) widget.setStyleSheet("QPushButton { font-weight: normal; }") try: self._selected_elements.remove(element) except ValueError: None if len(self._selected_elements) == 0 and self.multiple_select: self.btn_ok.setEnabled(False) return None
def __init__(self, parent=None, win=None, element="", info=()): super(RenameDialog, self).__init__(parent) self.sourceWin = parent self.info = info self.element = element title = "Rename: " + element self.setWindowTitle(title) layout = QtGui.QGridLayout() question = QtGui.QLabel("Please enter new name:") layout.addWidget(question, 0, 0) self.lineEdit = QtGui.QLineEdit() layout.addWidget(self.lineEdit, 0, 1) self.buttonOK = QtGui.QPushButton("OK", self) layout.addWidget(self.buttonOK, 1, 1) self.buttonCancel = QtGui.QPushButton("Cancel", self) layout.addWidget(self.buttonCancel, 1, 0) self.lineEdit.setText(self.element) self.setLayout(layout) self.buttonCancel.clicked.connect(self.cancelClicked) self.buttonOK.clicked.connect(self.okClicked)
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 setLang(self, langName): uiList_lang_read = self.memoData['lang'][langName] for ui_name in uiList_lang_read: ui_element = self.uiList[ui_name] if type(ui_element) in [ QtWidgets.QLabel, QtWidgets.QPushButton, QtWidgets.QAction, QtWidgets.QCheckBox ]: # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox if uiList_lang_read[ui_name] != "": ui_element.setText(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QGroupBox, QtWidgets.QMenu ]: # uiType: QMenu, QGroupBox if uiList_lang_read[ui_name] != "": ui_element.setTitle(uiList_lang_read[ui_name]) elif type(ui_element) in [ QtWidgets.QTabWidget]: # uiType: QTabWidget tabCnt = ui_element.count() if uiList_lang_read[ui_name] != "": tabNameList = uiList_lang_read[ui_name].split(';') if len(tabNameList) == tabCnt: for i in range(tabCnt): if tabNameList[i] != "": ui_element.setTabText(i,tabNameList[i]) elif type(ui_element) == str: # uiType: string for msg if uiList_lang_read[ui_name] != "": self.uiList[ui_name] = uiList_lang_read[ui_name]
def setupUi(self, Instructions): Instructions.setObjectName("Instructions") Instructions.setEnabled(True) Instructions.resize(400, 300) Instructions.setMinimumSize(QtCore.QSize(400, 300)) Instructions.setMaximumSize(QtCore.QSize(400, 300)) self.label = QtGui.QLabel(Instructions) self.label.setGeometry(QtCore.QRect(20, 10, 361, 271)) self.label.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.label.setWordWrap(True) self.label.setObjectName("label") self.pushButton_OK = QtGui.QPushButton(Instructions) self.pushButton_OK.setGeometry(QtCore.QRect(300, 260, 75, 23)) self.pushButton_OK.setObjectName("pushButton_OK") self.retranslateUi(Instructions) QtCore.QMetaObject.connectSlotsByName(Instructions)
def MySaveDialog(target=None): '''widget for save sketch into a file''' lm=getfiles() w=QtGui.QWidget() w.target=target box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) w.r=QtGui.QPushButton("save selected sketch as file") box.addWidget(w.r) w.r.pressed.connect(lambda :saveSketch(w)) w.show() return w
def dialogV(obj): '''erzeugen dialog vLayout''' w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) for p in obj.props: pw=createPropWidget( obj,p) box.addWidget(pw) w.r=QtGui.QPushButton("close") box.addWidget(w.r) w.r.pressed.connect(lambda :clear(w)) w.show() return w ##create controller main dialog
def init_params(self): QtGui.QWidget().setLayout(self.params_vbox) parts_vbox = QtGui.QGridLayout(self.params_widget) self.hide_button = QtGui.QPushButton('Hide others', self.params_widget) parts_vbox.addWidget(self.hide_button, 0, 0) self.hide_button.clicked.connect(self.hide_others) self.show_button = QtGui.QPushButton('Show all', self.params_widget) parts_vbox.addWidget(self.show_button, 0, 1) self.show_button.clicked.connect(self.show_initial_objects) self.set_transparency_button = QtGui.QPushButton('Set transparent', self.params_widget) parts_vbox.addWidget(self.set_transparency_button, 1, 0) self.set_transparency_button.clicked.connect(self.set_transparency) self.reset_transparency_button = QtGui.QPushButton('Restore transparent', self.params_widget) parts_vbox.addWidget(self.reset_transparency_button, 1, 1) self.reset_transparency_button.clicked.connect(self.restore_transparency) preview_button = QtGui.QPushButton('Preview', self.params_widget) parts_vbox.addWidget(preview_button,2,0,1,2) preview_button.clicked.connect(self.preview)
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_right_pane(self): self.right_pane = QtGui.QVBoxLayout() # RATE button self.rate_btn = QtGui.QPushButton("rate", self) self.rate_btn.clicked.connect(self.rate) self.right_pane.addWidget(self.rate_btn) # OPEN button self.open_btn = QtGui.QPushButton("open", self) self.open_btn.clicked.connect(lambda: webbrowser.open(self.cur_vid)) self.right_pane.addWidget(self.open_btn) # INFO box self.info_box = QtGui.QLabel(self) self.info_box.setText("") self.right_pane.addWidget(self.info_box) # SKIP button # by some magic this is aligned correctly self.skip_btn = QtGui.QPushButton("skip", self) self.skip_btn.clicked.connect(self.skip) self.right_pane.addWidget(self.skip_btn) self.layout.addLayout(self.right_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 addRemoveButton(self): self.frame_remove_btn = QtGui.QPushButton('rm') sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Minimum) sizePolicy.setHorizontalStretch(0) sizePolicy.setVerticalStretch(0) sizePolicy.setHeightForWidth(self.frame_remove_btn.sizePolicy().hasHeightForWidth()) self.frame_remove_btn.setSizePolicy(sizePolicy) self.frame_remove_btn.setMinimumSize(QtCore.QSize(16, 16)) self.frame_remove_btn.setMaximumSize(QtCore.QSize(16, 16)) self.frame_widget_layout.addWidget(self.frame_remove_btn) # ---------------------- # OBJECT WIDGET # the widget for displaying an object in a list
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 setupUi(self, Manual): Manual.setObjectName(_fromUtf8("Manual")) Manual.resize(740, 450) Manual.setMinimumSize(QtCore.QSize(740, 450)) Manual.setMaximumSize(QtCore.QSize(740, 450)) self.textBrowser = QtGui.QTextBrowser(Manual) self.textBrowser.setGeometry(QtCore.QRect(10, 40, 721, 371)) self.textBrowser.setObjectName(_fromUtf8("textBrowser")) self.label = QtGui.QLabel(Manual) self.label.setGeometry(QtCore.QRect(10, 10, 271, 21)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) font.setPointSize(12) font.setBold(True) font.setWeight(75) self.label.setFont(font) self.label.setObjectName(_fromUtf8("label")) self.manual_bn = QtGui.QPushButton(Manual) self.manual_bn.setGeometry(QtCore.QRect(650, 420, 75, 23)) font = QtGui.QFont() font.setFamily(_fromUtf8("Arial")) self.manual_bn.setFont(font) self.manual_bn.setObjectName(_fromUtf8("manual_bn")) self.retranslateUi(Manual) QtCore.QMetaObject.connectSlotsByName(Manual)
def setupUi(self, Form): Form.setObjectName("Form") Form.resize(241, 367) self.gridLayout = QtGui.QGridLayout(Form) self.gridLayout.setSpacing(0) self.gridLayout.setObjectName("gridLayout") self.label = QtGui.QLabel(Form) self.label.setObjectName("label") self.gridLayout.addWidget(self.label, 0, 0, 1, 3) self.itemTree = QtGui.QTreeWidget(Form) self.itemTree.setObjectName("itemTree") self.itemTree.headerItem().setText(0, "1") self.itemTree.header().setVisible(False) self.gridLayout.addWidget(self.itemTree, 1, 0, 1, 3) self.label_2 = QtGui.QLabel(Form) self.label_2.setObjectName("label_2") self.gridLayout.addWidget(self.label_2, 2, 0, 1, 3) self.formatList = QtGui.QListWidget(Form) self.formatList.setObjectName("formatList") self.gridLayout.addWidget(self.formatList, 3, 0, 1, 3) self.exportBtn = QtGui.QPushButton(Form) self.exportBtn.setObjectName("exportBtn") self.gridLayout.addWidget(self.exportBtn, 6, 1, 1, 1) self.closeBtn = QtGui.QPushButton(Form) self.closeBtn.setObjectName("closeBtn") self.gridLayout.addWidget(self.closeBtn, 6, 2, 1, 1) self.paramTree = ParameterTree(Form) self.paramTree.setObjectName("paramTree") self.paramTree.headerItem().setText(0, "1") self.paramTree.header().setVisible(False) self.gridLayout.addWidget(self.paramTree, 5, 0, 1, 3) self.label_3 = QtGui.QLabel(Form) self.label_3.setObjectName("label_3") self.gridLayout.addWidget(self.label_3, 4, 0, 1, 3) self.copyBtn = QtGui.QPushButton(Form) self.copyBtn.setObjectName("copyBtn") self.gridLayout.addWidget(self.copyBtn, 6, 0, 1, 1) self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
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 setupUi(self, sonosConnect): sonosConnect.setObjectName("sonosConnect") self.gridLayout = QtGui.QGridLayout(sonosConnect) self.connectList = QtGui.QListWidget(sonosConnect) QtGui.QListWidgetItem(self.connectList) self.gridLayout.addWidget(self.connectList, 0, 0, 1, 3) self.checkBox = QtGui.QCheckBox(sonosConnect) self.gridLayout.addWidget(self.checkBox, 2, 0, 1, 1) self.connectButton = QtGui.QPushButton(sonosConnect) self.gridLayout.addWidget(self.connectButton, 2, 2, 1, 1) self.rescanButton = QtGui.QPushButton(sonosConnect) self.gridLayout.addWidget(self.rescanButton, 2, 1, 1, 1) self.retranslateUi(sonosConnect) QtCore.QMetaObject.connectSlotsByName(sonosConnect)
def update_button(self): self.horizontalLayout.removeWidget(self.cancelButton) self.cancelButton.deleteLater() self.cancelButton = None self.downloaded = True self.okButton = QtGui.QPushButton("Ok") self.horizontalLayout.addWidget(self.okButton) self.okButton.clicked.connect(self.ok_function)
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 dialog(fn): w=QtGui.QWidget() box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel("Path to Image" ) box.addWidget(l) w.anz = QtGui.QLineEdit() w.anz.setText(fn) box.addWidget(w.anz) loff=QtGui.QLabel("Offset Border" ) box.addWidget(loff) w.off = QtGui.QLineEdit() w.off.setText("100") box.addWidget(w.off) w.rotpos=QtGui.QCheckBox("Rot +90") box.addWidget(w.rotpos) w.rotneg=QtGui.QCheckBox("Rot -90") box.addWidget(w.rotneg) w.rot180=QtGui.QCheckBox("Rot 180") box.addWidget(w.rot180) w.r=QtGui.QPushButton("run") box.addWidget(w.r) w.r.pressed.connect(lambda :runw(w)) w.show() return w
def __init__(self, dialer,obj,menu,noclose,*args): QtGui.QWidget.__init__(self, *args) obj.widget=self self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) self.vollabel =QtGui.QLabel( "<b>"+obj.Object.Label+"</b>") if dialer: dial = QtGui.QDial() dial.setNotchesVisible(True) self.dial=dial dial.setMaximum(100) dial.valueChanged.connect(obj.dialer); layout = QtGui.QVBoxLayout() layout.addWidget(self.vollabel) for m in menu: bt=QtGui.QPushButton(m[0]) bt.clicked.connect(m[1]) layout.addWidget(bt) if dialer: layout.addWidget(dial) if not noclose: self.pushButton02 = QtGui.QPushButton("close") self.pushButton02.clicked.connect(self.hide) layout.addWidget(self.pushButton02) self.setLayout(layout) try: self.setWindowTitle(obj.Object.target.Label) except: pass
def testme(): layout=''' VerticalLayoutTab: id:'main' QtGui.QLabel: setText:"*** N U R B S E D I T O R ***" VerticalLayout: HorizontalLayout: QtGui.QLabel: setText: "huhuwas 1 3" QtGui.QLabel: setText: "huhuwas 2 3" QtGui.QLabel: setText: "huhuwas 3 3" HorizontalLayout: QtGui.QLabel: setText:"Action " QtGui.QPushButton: setText: "Run Action" VerticalLayout: QtGui.QLineEdit: setText:"edit Axample" QtGui.QLineEdit: setText:"edit B" QtGui.QLineEdit: setText:"horizel " HorizontalLayout: QtGui.QLineEdit: setText:"AA" QtGui.QLineEdit: setText:"BB" ''' miki=Miki() #app.root=miki miki.parse2(layout) miki.run(layout)
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, saveToForm, parent=None): QtGui.QPushButton.__init__(self, parent) self.setText('...') self.setFixedWidth(30) self.setFlat(True) self.setStyleSheet(''' QPushButton { border: 1px solid #000; width: 13px; height: 19px; } ''') self.saveToForm = saveToForm
def __init__(self, parent=None): QtGui.QWidget.__init__(self, parent) # self.form = self self.form.setWindowTitle(u'Check collisions') self.form.setWindowIcon(QtGui.QIcon(":/data/img/collisions.png")) self.root = None self.obj = None self.tmpFile = None self.transaprency = {} # self.createSolid = QtGui.QCheckBox(u'Create solid on exit') # self.table1 = collisionObjectTable() # self.table2 = collisionObjectTable() # checkButton = QtGui.QPushButton(u"Check") self.connect(checkButton, QtCore.SIGNAL("released ()"), self.preview) # lay = QtGui.QGridLayout(self) lay.addWidget(checkButton, 0, 0, 1, 2) lay.addWidget(QtGui.QLabel(u'First group'), 1, 0, 1, 1) lay.addWidget(self.table1, 2, 0, 1, 1) lay.addWidget(QtGui.QLabel(u'Second group'), 1, 1, 1, 1) lay.addWidget(self.table2, 2, 1, 1, 1) lay.addWidget(self.createSolid, 3, 0, 1, 2) # self.readObjects() self.removeRoot()
def __init__(self, parent=None): QtGui.QPushButton.__init__(self, parent) self.setFlat(True) self.setStyleSheet(''' QPushButton { border: 0px; margin-top: 2px; width: 15px; height: 15px; } ''') #self.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
def __init__(self, parent=None): QtGui.QPushButton.__init__(self, parent) self.setStyleSheet(''' QPushButton { border: 1px solid #000; background-color: rgb(255, 0, 0); margin: 1px; } ''') self.setFlat(True) #self.setFixedSize(20, 20) self.kolor = [0., 0., 0.] # self.connect(self, QtCore.SIGNAL("released ()"), self.pickColor)
def setColor(self, nowyKolorRGB): self.kolor = nowyKolorRGB self.setStyleSheet(''' QPushButton { border: 1px solid #000; background-color: rgb(%i, %i, %i); margin: 1px; } ''' % (nowyKolorRGB[0], nowyKolorRGB[1], nowyKolorRGB[2]))
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)