我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用PySide.QtGui.QLabel()。
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 fv2(name="vertical",title=''): ''' create as a dock widget ''' t=QtGui.QLabel("my widget") w=MyDockWidget(t,"Reconstruction WB") if title <>'': w.setWindowTitle(title) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ComboViewShowWidget(w,True) # store it to FC.w5 try: FreeCAD.w5.append(w) except: FreeCAD.w5=[w] return w
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 fh2(name="vertik 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.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignLeft) w.setLayout(layout) #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 getdockwindowMgr2(): if 1: w = getMainWindowByName("name") t = QtGui.QLabel('Title 1') d = MyDockWidget(t,"huhu") w.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d) t = QtGui.QLabel('Title 2') d2 = MyDockWidget(t,"haha") w.addDockWidget(QtCore.Qt.LeftDockWidgetArea, d2) w.tabifyDockWidget(d2, d); w.show() FreeCAD.dockwindowMgr=w return w ################
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 __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowTitle(u'Add new category') # self.categoryName = QtGui.QLineEdit('') self.categoryName.setStyleSheet('background-color:#FFF;') self.categoryDescription = QtGui.QTextEdit('') # buttons buttons = QtGui.QDialogButtonBox() buttons.setOrientation(QtCore.Qt.Vertical) buttons.addButton("Cancel", QtGui.QDialogButtonBox.RejectRole) buttons.addButton("Add", QtGui.QDialogButtonBox.AcceptRole) self.connect(buttons, QtCore.SIGNAL("accepted()"), self, QtCore.SLOT("accept()")) self.connect(buttons, QtCore.SIGNAL("rejected()"), self, QtCore.SLOT("reject()")) # lay = QtGui.QGridLayout(self) lay.addWidget(QtGui.QLabel(u'Name'), 0, 0, 1, 1) lay.addWidget(self.categoryName, 0, 1, 1, 1) lay.addWidget(QtGui.QLabel(u'Desctiption'), 1, 0, 1, 1, QtCore.Qt.AlignTop) lay.addWidget(self.categoryDescription, 1, 1, 1, 1) lay.addWidget(buttons, 0, 2, 2, 1, QtCore.Qt.AlignCenter) lay.setRowStretch(1, 10)
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 __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, parent=None, win=None, xrefs=None, headers=["Origin", "Method"]): super(XrefListView, self).__init__(parent) self.parent = parent self.mainwin = win self.xrefs = xrefs self.headers = headers self.setMinimumSize(600, 400) self.filterPatternLineEdit = QtGui.QLineEdit() self.filterPatternLabel = QtGui.QLabel("&Filter origin pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.xrefwindow = XrefValueWindow(self, win, self.xrefs, self.headers) sourceLayout = QtGui.QVBoxLayout() sourceLayout.addWidget(self.xrefwindow) sourceLayout.addWidget(self.filterPatternLabel) sourceLayout.addWidget(self.filterPatternLineEdit) self.setLayout(sourceLayout)
def __init__(self, parent=None, win=None, session=None): super(StringsWindow, self).__init__(parent) self.mainwin = win self.session = session self.title = "Strings" self.filterPatternLineEdit = QtGui.QLineEdit() self.filterPatternLabel = QtGui.QLabel("&Filter string pattern:") self.filterPatternLabel.setBuddy(self.filterPatternLineEdit) self.filterPatternLineEdit.textChanged.connect(self.filterRegExpChanged) self.stringswindow = StringsValueWindow(self, win, session) sourceLayout = QtGui.QVBoxLayout() sourceLayout.addWidget(self.stringswindow) sourceLayout.addWidget(self.filterPatternLabel) sourceLayout.addWidget(self.filterPatternLineEdit) self.setLayout(sourceLayout)
def create_icon_box(self, name, text): style = 'width:48px;height:48px;background-color:white;border-radius:5px;border:1px solid rgb(50,50,50);' icon_label = QtGui.QLabel() icon_label.setStyleSheet(style) icon_label.setMaximumWidth(48) icon_label.setMinimumWidth(48) icon_label.setMaximumHeight(48) icon_label.setMinimumHeight(48) setattr(self, name, icon_label) icon_text = QtGui.QLabel(text) icon_text.setStyleSheet('font-size:10px;') icon_text.setAlignment(QtCore.Qt.AlignCenter) vbox = QVBoxLayout() vbox.setAlignment(QtCore.Qt.AlignCenter) vbox.addWidget(icon_label) vbox.addWidget(icon_text) vbox.setContentsMargins(0, 0, 0, 0) w = QtGui.QWidget() w.setLayout(vbox) w.setMaximumWidth(70) return w
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 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 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 fv2(name="vertical",title=''): ''' create as a dock widget ''' t=QtGui.QLabel("my widget") # w=MyDockWidget(t,"Reconstruction WB") w=MyWidget(t,"Reconstruction WB") if title <>'': w.setWindowTitle(title) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) ComboViewShowWidget(w,True) # store it to FC.w5 try: FreeCAD.w5.append(w) except: FreeCAD.w5=[w] return w
def fv(name="vertical",title=''): # w=QtGui.QWidget() t=QtGui.QLabel("my widget") w=MyDockWidget(t,"Reconstruction WB") ### w.setStyleSheet("QWidget { font: bold 18px;color:brown;border-style: outset;border-width: 3px;border-radius: 10px;border-color: blue;}") if title <>'': w.setWindowTitle(title) layout = QtGui.QVBoxLayout() layout.setAlignment(QtCore.Qt.AlignTop) #w.layout=layout #w.setLayout(layout) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) w.show() # ComboViewShowWidget(w,True) try: FreeCAD.w5.append(w) except: FreeCAD.w5=[w] return w
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 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, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(573, 391) self.verticalLayout = QtGui.QVBoxLayout(Dialog) self.verticalLayout.setObjectName("verticalLayout") self.table = QtGui.QTableWidget(Dialog) self.table.setObjectName("table") self.table.setColumnCount(0) self.table.setRowCount(0) self.verticalLayout.addWidget(self.table) self.label = QtGui.QLabel(Dialog) font = QtGui.QFont() font.setPointSize(12) font.setWeight(75) font.setItalic(False) font.setBold(True) self.label.setFont(font) self.label.setFrameShape(QtGui.QFrame.NoFrame) self.label.setTextFormat(QtCore.Qt.AutoText) self.label.setAlignment(QtCore.Qt.AlignCenter) self.label.setObjectName("label") self.verticalLayout.addWidget(self.label) self.retranslateUi(Dialog) QtCore.QMetaObject.connectSlotsByName(Dialog)
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 build_ui(self): grid = QtGui.QGridLayout() grid.setVerticalSpacing(1) grid.setHorizontalSpacing(2) scale = 2 for row_num, line in enumerate(self.keyboard_grid): col_index = 0 for letter, width, button_type in line: key = button_type(letter) key.KEY_CLICKED.connect(self.button_press) if letter == "": key = QtGui.QLabel("") grid.addWidget(key, row_num, col_index, 1, width * scale) col_index += width * scale if letter not in self.key_map: self.key_map[letter] = [] self.key_map[letter].append(weakref.ref(key)) self.setLayout(grid) self.setWindowTitle('Calculator') self.resize(650, 200)
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(529, 329) self.selInfoWidget = QtGui.QWidget(Form) self.selInfoWidget.setGeometry(QtCore.QRect(260, 10, 264, 222)) self.selInfoWidget.setObjectName("selInfoWidget") self.gridLayout = QtGui.QGridLayout(self.selInfoWidget) self.gridLayout.setContentsMargins(0, 0, 0, 0) self.gridLayout.setObjectName("gridLayout") self.selDescLabel = QtGui.QLabel(self.selInfoWidget) self.selDescLabel.setText("") self.selDescLabel.setAlignment(QtCore.Qt.AlignLeading|QtCore.Qt.AlignLeft|QtCore.Qt.AlignTop) self.selDescLabel.setWordWrap(True) self.selDescLabel.setObjectName("selDescLabel") self.gridLayout.addWidget(self.selDescLabel, 0, 0, 1, 1) self.selNameLabel = QtGui.QLabel(self.selInfoWidget) font = QtGui.QFont() font.setWeight(75) font.setBold(True) self.selNameLabel.setFont(font) self.selNameLabel.setText("") self.selNameLabel.setObjectName("selNameLabel") self.gridLayout.addWidget(self.selNameLabel, 0, 1, 1, 1) self.selectedTree = DataTreeWidget(self.selInfoWidget) self.selectedTree.setObjectName("selectedTree") self.selectedTree.headerItem().setText(0, "1") self.gridLayout.addWidget(self.selectedTree, 1, 0, 1, 2) self.hoverText = QtGui.QTextEdit(Form) self.hoverText.setGeometry(QtCore.QRect(0, 240, 521, 81)) self.hoverText.setObjectName("hoverText") self.view = FlowchartGraphicsView(Form) self.view.setGeometry(QtCore.QRect(0, 0, 256, 192)) self.view.setObjectName("view") self.retranslateUi(Form) QtCore.QMetaObject.connectSlotsByName(Form)
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): """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 runwid(text): w=QtGui.QWidget() w.setStyleSheet("QLabel { color: rgb(255, 0, 0); font-size: 20px; background-color: rgba(255, 255, 100, 100); border: 1px solid rgba(188, 188, 188, 250); }") w.setGeometry(800, 400, 10, 10) box = QtGui.QVBoxLayout() w.setLayout(box) w.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint) l=QtGui.QLabel(text) box.addWidget(l) return w
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 GDTDialog_hbox( label, inputWidget): hbox = QtGui.QHBoxLayout() hbox.addWidget( QtGui.QLabel(label) ) if inputWidget <> None: hbox.addStretch(1) hbox.addWidget(inputWidget) 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): 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): super(MyDialog, self).__init__() self.label = QtGui.QLabel( u'Press <ESC> to exit. Some non-ascii chars: ??š?íá?' u'\nor wait some seconds', self) self.setWindowTitle('Hello World from PySide') self.resize(400, 200) self.show() # close window after 1.5 seconds QtCore.QTimer.singleShot(1500, self.close)
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)