def __init__(self, parent=None, color=None): # pylint: disable=E1101 # E1101: DemoWidget.__init__: Module 'PyQt4.QtCore' has no 'QMargins' member QtGui.QWidget.__init__(self, parent) self.setLayout(QtGui.QVBoxLayout()) self.layout().setContentsMargins(QtCore.QMargins(0, 0, 0, 0)) self.layout().setSpacing(0) text = QtGui.QTextEdit() self.layout().addWidget(text) DemoWidget.count += 1 text.setPlainText("#%d" % DemoWidget.count) button_layout = QtGui.QHBoxLayout() button_layout.setContentsMargins(QtCore.QMargins(5, 5, 5, 5)) self.layout().addLayout(button_layout) button_layout.addWidget(QtGui.QPushButton("Go")) button_layout.addWidget(QtGui.QPushButton("Stop")) if color: self.setStyleSheet("background-color: %s;" % color)
def setStyle(self): self.setMinimumSize(600, 35) self.setStyleSheet(cp.styleBkgd) #self. setStyleSheet (cp.styleYellowish) self.lab_from.setStyleSheet(cp.styleLabel) self.lab_to.setStyleSheet(cp.styleLabel) self.lab_run.setStyleSheet(cp.styleLabel) self.but_depl.setStyleSheet(cp.styleButtonGood) #self.lab_rnum .setFixedWidth(60) self.lab_type.setMinimumWidth(250) self.edi_from.setFixedWidth(40) self.edi_to.setFixedWidth(40) self.but_go.setFixedWidth(60) self.but_depl.setFixedWidth(60) self.edi_from.setAlignment(QtCore.Qt.AlignRight) self.edi_to.setAlignment(QtCore.Qt.AlignRight) #self.but_go.setEnabled(self.str_run_number != 'None' and self.lab_rnum.isEnabled()) self.setContentsMargins(QtCore.QMargins(0, -9, 0, -9)) #self.setContentsMargins (QtCore.QMargins(0,5,0,0)) self.setStatusStyleOfButtons()
def setStyle(self): #self.setMinimumSize(600,70) #self.setMinimumSize(600,70) self.setFixedHeight(35) self.setStyleSheet(cp.styleBkgd) #self.cbx_dark_more.setFixedHeight(30) self.lab_show.setStyleSheet(cp.styleLabel) width = 80 self.but_fxtc.setFixedWidth(60) self.but_srcs.setFixedWidth(90) self.but_sxtc.setFixedWidth(90) self.but_flst.setFixedWidth(60) self.but_show.setFixedWidth(80) self.but_view.setFixedWidth(90) self.but_plot.setFixedWidth(60) #self.setContentsMargins (QtCore.QMargins(-9,-9,-9,-9)) self.setContentsMargins(QtCore.QMargins(-5, -5, -5, -5)) #self.setContentsMargins (QtCore.QMargins(10,10,10,10)) #self.setContentsMargins (QtCore.QMargins(0,5,0,0)) #self.but_srcs.setVisible( self.cbx_dark_more.isChecked() ) #self.but_sxtc.setVisible( self.cbx_dark_more.isChecked() ) #self.but_flst.setVisible( self.cbx_dark_more.isChecked() ) #self.but_fxtc.setVisible( self.cbx_dark_more.isChecked() ) #self.but_show.setVisible( self.cbx_dark_more.isChecked() ) self.but_view.setVisible(self.cbx_dark_more.isChecked()) self.but_plot.setVisible(self.cbx_dark_more.isChecked())
def setStyle(self): self.setStyleSheet(cp.styleBkgd) self.but_move.setStyleSheet(cp.styleButton) self.but_copy.setStyleSheet(cp.styleButton) self.but_delete.setStyleSheet(cp.styleButton) self.but_view.setStyleSheet(cp.styleButton) self.but_plot.setStyleSheet(cp.styleButton) self.setMinimumSize(630, 100) self.setFixedHeight(100) self.setContentsMargins(QtCore.QMargins(0, -9, 0, -9)) #self.but_copy.setFixedWidth(100) #self.but_delete.setFixedWidth(100) #self.but_copy.setMinimumHeight(60) self.edi_from.setFixedWidth(40) self.edi_to.setFixedWidth(40) self.edi_file.setFixedWidth(490) self.edi_file.setStyleSheet(cp.styleEditInfo) self.edi_file.setEnabled(False) self.lab_file.setStyleSheet(cp.styleLabel) self.lab_src.setStyleSheet(cp.styleLabel) self.lab_type.setStyleSheet(cp.styleLabel) self.lab_from.setStyleSheet(cp.styleLabel) self.lab_to.setStyleSheet(cp.styleLabel) #self.butViewwser.setVisible(False) #self.butSave.setText('') #self.butExit.setText('') #self.butExit.setFlat(True) self.setStyleButtons()
def setStyle(self): self.setContentsMargins (QtCore.QMargins(-5,-5,-5,2)) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) #self.hbox.moveSplitter(250, self.hbox.indexOf(self.guifilemanagergroupcontrol)) self.hsplitter.setSizes([200,100,600])
def createPopup(self): self.popup = dialog = QDialog(self) dialog.setWindowFlags(Qt.Qt.Dialog | Qt.Qt.FramelessWindowHint) # dialog.setModal(True) layout = QGridLayout() createKineticModelButton = QPushButton("Create Kinetic Model") loadKineticModelButton = QPushButton("Load Model") loadNeuronalModelButton = QPushButton("Load Neuronal Model") # createKineticModelButton.setStyleSheet( # """QPushButton { font-size : 18pt; # font-weight: bold; # color : #000000; # } # """ ) layout.setContentsMargins(QtCore.QMargins(20,20,20,20)) # layout.addWidget(QLabel(""), 0, 0) layout.addWidget(createKineticModelButton) # layout.addWidget(QLabel(" "), 0, 2) # layout.addWidget(QLabel(" "), 1, 0) layout.addWidget(loadKineticModelButton) # layout.addWidget(QLabel(" "), 1, 2) # layout.addWidget(QLabel(" "), 2, 0) # layout.addWidget(loadNeuronalModelButton) # layout.addWidget(QLabel(" "), 2, 2) dialog.setLayout(layout) createKineticModelButton.clicked.connect(self.newModelDialogSlot) loadKineticModelButton.clicked.connect(self.loadModelDialogSlot) loadNeuronalModelButton.clicked.connect(self.loadModelDialogSlot) dialog.show() return dialog
def setStyle(self): #self.setFixedWidth(200) self.setMinimumWidth(200) self.setMaximumWidth(500) #self.setStyleSheet(cp.styleBkgd) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.move(QtGui.QCursor.pos())
def process_property(xmlprop, widget=widget): pname = xmlprop.get("name") if pname in translate_properties: pname = translate_properties[pname] setpname = "set" + pname[0].upper() + pname[1:] if pname == "layoutSpacing": set_fn = widget.layout.setSpacing else: set_fn = getattr(widget, setpname, None) if set_fn is None: print("qt3ui: Missing property", pname, " for %r" % widget.__class__) return #print "Found property", pname if pname == "contentsMargins" or pname == "layoutSpacing": try: value = int(xmlprop.get("stdset")) except Exception as e: value = 0 if pname == "contentsMargins": value = QtCore.QMargins(value, value, value, value) else: value = loadVariant(xmlprop) try: set_fn(value) except Exception as e: print(e, repr(value)) print(etree.tostring(xmlprop))
def setStyle(self): #self.setMinimumSize(600,70) #self.setMinimumSize(600,70) self.setFixedHeight(40) self.setStyleSheet(cp.styleBkgd) self.cbx_dark_more.setFixedHeight(30) width = 80 self.but_srcs.setFixedWidth(width) self.but_flst.setFixedWidth(width) self.but_fbro.setFixedWidth(width) self.but_plot.setFixedWidth(width) self.but_show.setFixedWidth(width) #self.setContentsMargins (QtCore.QMargins(-9,-9,-9,-9)) self.setContentsMargins(QtCore.QMargins(-5, -5, -5, -5)) #self.setContentsMargins (QtCore.QMargins(10,10,10,10)) #self.setContentsMargins (QtCore.QMargins(0,5,0,0)) self.but_srcs.setVisible(self.cbx_dark_more.isChecked()) self.but_flst.setVisible(self.cbx_dark_more.isChecked()) self.but_fbro.setVisible(self.cbx_dark_more.isChecked()) self.but_plot.setVisible(self.cbx_dark_more.isChecked()) self.but_show.setVisible(self.cbx_dark_more.isChecked())
def setStyle(self): #self.setStyleSheet(cp.styleYellow) self.labRuns.setStyleSheet(cp.styleLabel) self.labDets.setStyleSheet(cp.styleLabel) self.setStyleButtons() self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.setMinimumSize(390, 28)
def set_style(self): self.setGeometry(200, 400, 500, 300) self.setStyleSheet(style.styleBkgd) #self.tit_title.setStyleSheet(style.styleTitleBold) self.tit_status.setStyleSheet(style.styleTitle) self.tit_level.setStyleSheet(style.styleTitle) self.but_close.setStyleSheet(style.styleButton) self.but_save.setStyleSheet(style.styleButton) self.box_level.setStyleSheet(style.styleButton) self.box_txt.setReadOnly(True) self.box_txt.setStyleSheet(style.styleWhiteFixed) #self.box_txt .ensureCursorVisible() #self.tit_title.setAlignment(QtCore.Qt.AlignCenter) #self.titTitle.setBold() self.tit_status.setVisible(self.show_buttons) self.tit_level.setVisible(self.show_buttons) self.box_level.setVisible(self.show_buttons) self.but_save.setVisible(self.show_buttons) self.but_close.setVisible(self.show_buttons) if not self.show_buttons: self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.setMinimumHeight(50) self.setMinimumSize(300, 50)
def setPanelLayout(self): self.hbox1 = QtGui.QHBoxLayout() self.hbox1.addWidget(self.but_help) self.hbox1.addWidget(self.tit_nbins) self.hbox1.addWidget(self.edi_nbins) self.hbox1.addWidget(self.cbox_grid) self.hbox1.addWidget(self.tit_log) self.hbox1.addWidget(self.cbox_logx) self.hbox1.addWidget(self.cbox_logy) self.hbox1.addWidget(self.but_reset) self.hbox1.addStretch(1) self.hbox1.addWidget(self.but_elog) self.hbox1.addWidget(self.but_quit) self.hbox1.addWidget(self.but_more) self.guirange = GUIRangeIntensity(self, None, None, txt_from='Spec range', txt_to=':') self.hbox2 = QtGui.QHBoxLayout() self.hbox2.addWidget(self.but_load) self.hbox2.addWidget(self.but_diff) self.hbox2.addWidget(self.guirange) self.hbox2.addStretch(1) self.hbox2.addWidget(self.but_save) self.vbox = QtGui.QVBoxLayout() self.vbox.addLayout(self.hbox2) self.vbox.addLayout(self.hbox1) self.vbox.addStretch(1) self.setLayout(self.vbox) self.setContentsMargins (QtCore.QMargins(0,-5,0,-5)) self.setPannel()
def setStyle(self): pass #self.setMinimumSize(100,400) self.setMinimumWidth(150) self.setMaximumWidth(500) self.setMinimumHeight(500) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): self.setMinimumSize(600,70) self. setStyleSheet (cp.styleBkgd) self.lab_from.setStyleSheet(cp.styleLabel) self.lab_to .setStyleSheet(cp.styleLabel) self.lab_run .setStyleSheet(cp.styleLabel) self.but_run .setFixedWidth(80) self.edi_from .setFixedWidth(40) self.edi_to .setFixedWidth(40) self.but_go .setFixedWidth(80) self.edi_from .setAlignment (QtCore.Qt.AlignRight) self.edi_to .setAlignment (QtCore.Qt.AlignRight) if self.str_run_number.value() == 'None' and self.but_run.isEnabled() : self.but_run.setStyleSheet(cp.styleButtonBad) else : self.but_run.setStyleSheet(cp.styleDefault) if self.edi_from.isReadOnly() : self.edi_from.setStyleSheet (cp.styleEditInfo) else : self.edi_from.setStyleSheet (cp.styleEdit) if self.edi_to.isReadOnly() : self.edi_to.setStyleSheet (cp.styleEditInfo) else : self.edi_to.setStyleSheet (cp.styleEdit) self.but_go.setEnabled(self.str_run_number.value() != 'None' and self.but_run.isEnabled()) #self.setContentsMargins (QtCore.QMargins(-9,-9,-9,-9)) #self.setContentsMargins (QtCore.QMargins(10,10,10,10)) self.setContentsMargins (QtCore.QMargins(0,5,0,0))
def main(): app = Qt.QApplication(sys.argv) wdg = DemoWidget() wdg2 = DemoWidget() splitter = NestedSplitter() splitter.addWidget(wdg) splitter.addWidget(wdg2) class DemoProvider: def ns_provides(self): return [('Add demo widget', '_add_demo_widget')] def ns_provide(self, id_): if id_ == '_add_demo_widget': return DemoWidget() splitter.register_provider(DemoProvider()) # pylint: disable=E1101 # E1101:main: Module 'PyQt4.QtCore' has no 'QMargins' member holder = QtGui.QWidget() holder.setLayout(QtGui.QVBoxLayout()) holder.layout().setContentsMargins(QtCore.QMargins(0, 0, 0, 0)) holder.layout().addWidget(splitter) holder.show() app.exec_()
def setStyle(self): pass #self.setMinimumSize(100,200) #self.setMinimumSize(200,300) #self.setFixedWidth(300) self.setMinimumWidth(200) #self.setMinimumHeight(300) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): self.setWindowTitle('Select experiment') self.setFixedWidth(120) self.setMinimumHeight(600) #self.setMaximumWidth(600) #self.setStyleSheet(cp.styleBkgd) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) #self.setStyleSheet(cp.styleBkgd) #self.but_cancel.setStyleSheet(cp.styleButton) #self.but_apply.setStyleSheet(cp.styleButton) self.move(QtGui.QCursor.pos().__add__(QtCore.QPoint(-110, -50)))
def setStyle(self): self.setStyleSheet(cp.styleBkgd) #self.tit_status.setStyleSheet (cp.styleTitle) #self.tit_status.setStyleSheet (cp.styleDefault) #self.tit_status.setStyleSheet (cp.styleTitleInFrame) self.box_txt.setReadOnly(True) self.box_txt.setStyleSheet(cp.styleBkgd) self.setContentsMargins(QtCore.QMargins(10, 20, 10, 10)) #self.setMinimumHeight(60) self.setMinimumSize(300, 60)
def __init__(self, label, digits, minmax, wrap, toggable, lineeditlength, regexpstring=None, tooltip=None): QtGui.QFrame.__init__(self) self.setFrameShape(QtGui.QFrame.Box) #self.setStyleSheet("QFrame {font-size: 8pt}\nQSlider::groove:horizontal {height: 8px}\nQSlider::handle:horizontal {width: 18px}\nQLineEdit, QPushButton {font-size: 8pt;}\n") self.qboxlayout = QtGui.QBoxLayout(QtGui.QBoxLayout.LeftToRight, self) self.qlabel = QtGui.QLabel(label) self.qlcd = QtGui.QLCDNumber(digits) self.qlcd.setFixedHeight(16) #self.qlcd.setSmallDecimalPoint(True) self.qlcd.setStyleSheet( "QFrame {background-color: black; color: red; }") self.qlcd.setSegmentStyle(QtGui.QLCDNumber.Filled) #self.qslider=QtGui.QSlider(QtCore.Qt.Horizontal) self.qslider = QtGui.QDial() self.qslider.setFixedHeight(30) self.qslider.setWrapping(wrap) self.qslider.setMinimum(minmax[0]) self.qslider.setMaximum(minmax[1]) self.qlineedit = QtGui.QLineEdit() if regexpstring != None: self.qlineedit.setValidator( QtGui.QRegExpValidator(QtCore.QRegExp(regexpstring))) self.qlineedit.sizeHint = lambda: QtCore.QSize( (lineeditlength * 10), 14) if tooltip != None: self.qlineedit.setToolTip(tooltip) self.qbutton = QtGui.QPushButton('Set') self.qbutton.sizeHint = lambda: QtCore.QSize((30), 24) self.qboxlayout.addWidget(self.qlabel) self.qboxlayout.addWidget(self.qlcd) self.qboxlayout.addWidget(self.qslider) self.qboxlayout.addWidget(self.qlineedit) self.qboxlayout.addWidget(self.qbutton) #QtCore.QObject.connect(self.qslider, QtCore.SIGNAL('valueChanged()'), self.changeValue) self.qslider.valueChanged.connect(self.changeValue) #self.qlineedit.editingFinished.connect(lambda:self.changeValue(float(self.qlineedit.text()))) self.qlineedit.editingFinished.connect(self.qbutton.click) self.qbutton.clicked.connect( lambda: self.changeValue(float(self.qlineedit.text()))) #QtGui.QObject.connect(self.qslider, SIGNAL(valueChanged(int v)), self.qlcd, SLOT(display(float v)) self.qboxlayout.setContentsMargins(QtCore.QMargins(5, 0, 5, 0)) self.sizeHint = lambda: QtCore.QSize(260, 70) self.show()
def setStyle(self): self. setStyleSheet(cp.styleBkgd) self.setMinimumSize(225,32) #self.setFixedHeight(40) self.setContentsMargins (QtCore.QMargins(0,-9,0,-9)) self.edi_from.setFixedWidth(40) self.edi_to .setFixedWidth(40) self.lab_from .setStyleSheet(cp.styleLabel) self.lab_to .setStyleSheet(cp.styleLabel) self.setStyleButtons()
def setStyle(self): self.setWindowTitle('Select') self.setFixedWidth(215) lst_len = self.list.__len__() self.setMinimumHeight(30 * lst_len + 10) #self.setMaximumWidth(600) #self.setStyleSheet(style.styleBkgd) self.setWindowFlags(self.windowFlags() | QtCore.Qt.FramelessWindowHint) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) #self.setStyleSheet(style.styleBkgd) #self.but_create.setStyleSheet(style.styleButton) #self.but_apply.setStyleSheet(style.styleButton) self.but_cancel.setStyleSheet(style.styleButton) self.but_cancel.setFixedSize(200, 30) self.move(QtGui.QCursor.pos().__add__(QtCore.QPoint(-110, -50)))
def setStyle(self): self.setMinimumSize(600, 30) self.setStyleSheet(cp.styleBkgd) #self. setStyleSheet (cp.styleYellowish) self.but_expand_shrink.setFixedSize(20, 22) #self.but_expand_shrink.setStyleSheet(cp.styleButtonGood) self.but_expand_shrink.setStyleSheet(cp.stylePink) #self.lab_from.setStyleSheet(cp.styleLabel) #self.lab_rnum .setFixedWidth(80) #self.edi_from .setAlignment (QtCore.Qt.AlignRight) #if self.edi_from.isReadOnly() : self.edi_from.setStyleSheet (cp.styleEditInfo) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): self.setStyleSheet(cp.styleBkgd) self.but_move.setStyleSheet(cp.styleButton) self.but_copy.setStyleSheet(cp.styleButton) self.but_delete.setStyleSheet(cp.styleButton) self.but_list.setStyleSheet(cp.styleButton) self.but_view.setStyleSheet(cp.styleButton) self.but_plot.setStyleSheet(cp.styleButton) self.lab_from.setStyleSheet(cp.styleLabel) self.lab_from.setAlignment(QtCore.Qt.AlignCenter) self.setMinimumSize(130, 200) self.setFixedWidth(130) self.setContentsMargins(QtCore.QMargins(0, -9, 0, -9)) self.setStyleButtons()
def setStyle(self): pass #self.adjustSize() #self. setStyleSheet(cp.styleBkgd) #self.butSave.setStyleSheet(cp.styleButton) #self.butExit.setStyleSheet(cp.styleButton) #self.butELog.setStyleSheet(cp.styleButton) #self.butFile.setStyleSheet(cp.styleButton) #self.butELog .setVisible(False) #self.butFBrowser.setVisible(False) #self.butExit.setText('') #self.butExit.setFlat(True) self.setMinimumHeight(250) #self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): self.setStyleSheet(cp.styleBkgd) #self.tit_status.setStyleSheet (cp.styleTitle) #self.tit_status.setStyleSheet (cp.styleDefault) #self.tit_status.setStyleSheet (cp.styleTitleInFrame) self.box_txt.setReadOnly(True) #self.box_txt .setStyleSheet (cp.styleWhiteFixed) self.box_txt.setStyleSheet(cp.styleBkgd) #self.setContentsMargins (QtCore.QMargins(-9,-9,-9,-9)) #self.setContentsMargins (QtCore.QMargins(10,10,10,10)) self.setContentsMargins(QtCore.QMargins(10, 20, 10, 10)) #self.setMinimumWidth(300) #self.setFixedHeight(200) self.setMinimumHeight(100) self.setBaseSize(600, 100)
def set_style(self): #self.setGeometry(50, 50, 500, 600) self.setGeometry(self.main_win_pos_x .value(),\ self.main_win_pos_y .value(),\ self.main_win_width .value(),\ self.main_win_height.value()) self.setMinimumSize(1200, 700) w = self.main_win_width.value() self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.wspe.setFixedHeight(280) self.wimg.setMinimumWidth(700) self.wimg.setSizePolicy(QtGui.QSizePolicy.Ignored, QtGui.QSizePolicy.Ignored) self.wrig.setContentsMargins(-9, -9, -9, -9) self.wrig.setMinimumWidth(350) self.wrig.setMaximumWidth(450)
def setStyle(self): self.setStyleSheet(cp.styleBkgd) if self.use_lab_from: self.setMinimumSize(200, 32) else: self.setMinimumSize(100, 32) #self.setFixedHeight(40) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.edi_from.setFixedWidth(40) self.edi_to.setFixedWidth(40) self.edi_from.setAlignment(QtCore.Qt.AlignRight) self.edi_to.setAlignment(QtCore.Qt.AlignRight) if self.use_lab_from: self.lab_from.setStyleSheet(cp.styleLabel) self.lab_to.setStyleSheet(cp.styleLabel) self.setStyleButtons()
def setStyle(self): self.setMinimumWidth(self.widg_width) #self.setFixedHeight(400) self.setMinimumHeight(200) #self.setBaseSize(600, 400) self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding) #self.setAlignment(QtCore.Qt.AlignTop | QtCore.Qt.AlignLeft) self.setStyleSheet(cp.styleBkgd) #self.list.adjustSize() #print 'self.list.size():', self.list.size() #self.setMinimumSize(self.list.size()) #self.tit_status.setStyleSheet (cp.styleTitle) #self.tit_status.setStyleSheet (cp.styleDefault) #self.tit_status.setStyleSheet (cp.styleTitleInFrame) #self.lab_txt .setReadOnly (True) #self.lab_txt .setStyleSheet (cp.styleWhiteFixed) #self.lab_txt .setStyleSheet (cp.styleBkgd) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): pass self.setMinimumSize(800, 700) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9))
def setStyle(self): #self.gui_table.setStyleSheet(cp.styleYellowish) #self.gui_table.setMinimumHeight(100) self.setContentsMargins(QtCore.QMargins(-9, -9, -9, -9)) self.setStyleSheet(cp.styleBkgd)