def __init__(self, device, rules): QGroupBox.__init__(self, _('Format specific sending')) self._device = weakref.ref(device) self.l = l = QVBoxLayout() self.setLayout(l) self.la = la = QLabel( '<p>' + _('''You can create rules that control where ebooks of a specific format are sent to on the device. These will take precedence over the folders specified above.''')) la.setWordWrap(True) l.addWidget(la) self.sa = sa = QScrollArea(self) sa.setWidgetResizable(True) self.w = w = QWidget(self) w.l = QVBoxLayout() w.setLayout(w.l) sa.setWidget(w) l.addWidget(sa) self.widgets = [] for rule in rules: r = Rule(device, rule) self.widgets.append(r) w.l.addWidget(r) r.remove.connect(self.remove_rule) if not self.widgets: self.add_rule() self.b = b = QPushButton(QIcon(I('plus.png')), _('Add a &new rule')) l.addWidget(b) b.clicked.connect(self.add_rule) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Ignored)
def __init__(self): QGroupBox.__init__(self) self.treemodel = treemodel = TestNe1Model() self.view = view = ModelTree("Model tree", treemodel, self) view.mt_update() def thunk(str): def _thunk(str=str): print str return _thunk self.chunkNum = 2 self.gbox = QGroupBox() vl = QVBoxLayout(self) vl.setSpacing(0) vl.setMargin(0) vl.addWidget(self.view) self.buttonLayout = hl = QHBoxLayout() hl.setSpacing(0) hl.setMargin(0) vl.addLayout(hl) self.buttonNum = 1 for func in (self.addmol, self.addjig, self.selected): self.addButton(func)
def __init__(self, device, rules): QGroupBox.__init__(self, _('Format specific sending')) self._device = weakref.ref(device) self.l = l = QVBoxLayout() self.setLayout(l) self.la = la = QLabel('<p>'+_( '''You can create rules that control where ebooks of a specific format are sent to on the device. These will take precedence over the folders specified above.''')) la.setWordWrap(True) l.addWidget(la) self.sa = sa = QScrollArea(self) sa.setWidgetResizable(True) self.w = w = QWidget(self) w.l = QVBoxLayout() w.setLayout(w.l) sa.setWidget(w) l.addWidget(sa) self.widgets = [] for rule in rules: r = Rule(device, rule) self.widgets.append(r) w.l.addWidget(r) r.remove.connect(self.remove_rule) if not self.widgets: self.add_rule() self.b = b = QPushButton(QIcon(I('plus.png')), _('Add a &new rule')) l.addWidget(b) b.clicked.connect(self.add_rule) self.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Ignored)
def __init__(self, parent, title = ''): QGroupBox.__init__(self) if parent: self.setParent(parent) #Fixed bug 2465 -- ninad 20070622 self.setAutoFillBackground(True) self.setPalette(self.getPropMgrGroupBoxPalette()) self.setStyleSheet(self.getStyleSheet()) # Create vertical box layout self.VBoxLayout = QVBoxLayout(self) self.VBoxLayout.setMargin(pmMsgGrpBoxMargin) self.VBoxLayout.setSpacing(pmMsgGrpBoxSpacing) # Add title button to GroupBox self.titleButton = self.getTitleButton(title, self) self.VBoxLayout.addWidget(self.titleButton) self.connect(self.titleButton,SIGNAL("clicked()"), self.toggleExpandCollapse) # Yellow MessageTextEdit self.MessageTextEdit = QtGui.QTextEdit(self) self.MessageTextEdit.setMaximumHeight(80) # 80 pixels height self.MessageTextEdit.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.VBoxLayout.addWidget(self.MessageTextEdit) msg_palette = self.getMessageTextEditPalette() self.MessageTextEdit.setPalette(msg_palette) self.MessageTextEdit.setReadOnly(True) # wrapWrapMode seems to be set to QTextOption.WrapAnywhere on MacOS, # so let's force it here. Mark 2007-05-22. self.MessageTextEdit.setWordWrapMode(QTextOption.WordWrap) # These two policies very important. Mark 2007-05-22 self.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.MessageTextEdit.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.setWhatsThis("""<b>Messages</b> <p>This prompts the user for a requisite operation and/or displays helpful messages to the user.</p>""") parent.MessageTextEdit = self.MessageTextEdit self.hide()
def __init__(self, parent, title=''): QGroupBox.__init__(self) if parent: self.setParent(parent) #Fixed bug 2465 -- ninad 20070622 self.setAutoFillBackground(True) self.setPalette(self.getPropMgrGroupBoxPalette()) self.setStyleSheet(self.getStyleSheet()) # Create vertical box layout self.VBoxLayout = QVBoxLayout(self) self.VBoxLayout.setMargin(pmMsgGrpBoxMargin) self.VBoxLayout.setSpacing(pmMsgGrpBoxSpacing) # Add title button to GroupBox self.titleButton = self.getTitleButton(title, self) self.VBoxLayout.addWidget(self.titleButton) self.connect(self.titleButton, SIGNAL("clicked()"), self.toggleExpandCollapse) # Yellow MessageTextEdit self.MessageTextEdit = QtGui.QTextEdit(self) self.MessageTextEdit.setMaximumHeight(80) # 80 pixels height self.MessageTextEdit.setHorizontalScrollBarPolicy( Qt.ScrollBarAlwaysOff) self.VBoxLayout.addWidget(self.MessageTextEdit) msg_palette = self.getMessageTextEditPalette() self.MessageTextEdit.setPalette(msg_palette) self.MessageTextEdit.setReadOnly(True) # wrapWrapMode seems to be set to QTextOption.WrapAnywhere on MacOS, # so let's force it here. Mark 2007-05-22. self.MessageTextEdit.setWordWrapMode(QTextOption.WordWrap) # These two policies very important. Mark 2007-05-22 self.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.MessageTextEdit.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self.setWhatsThis("""<b>Messages</b> <p>This prompts the user for a requisite operation and/or displays helpful messages to the user.</p>""") parent.MessageTextEdit = self.MessageTextEdit self.hide()
def __init__(self): QGroupBox.__init__(self) self.treemodel = treemodel = TestNe1Model() self.view = view = ModelTreeGui(TestMainWindow(), "Model tree", treemodel, self) view.mt_update() self.chunkNum = 2 self.gbox = QGroupBox() vl = QVBoxLayout(self) vl.setSpacing(0) vl.setMargin(0) vl.addWidget(self.view) self.buttonLayout = hl = QHBoxLayout() hl.setSpacing(0) hl.setMargin(0) vl.addLayout(hl) self.buttonNum = 1 for func in (self.addmol, self.addjig, self.selected): self.addButton(func)
def __init__(self, parentWidget, title = '', connectTitleButton = True, setAsDefault = True ): """ Appends a PM_GroupBox widget to I{parentWidget}, a L{PM_Dialog} or a L{PM_GroupBox}. If I{parentWidget} is a L{PM_Dialog}, the group box will have a title button at the top for collapsing and expanding the group box. If I{parentWidget} is a PM_GroupBox, the title will simply be a text label at the top of the group box. @param parentWidget: The parent dialog or group box containing this widget. @type parentWidget: L{PM_Dialog} or L{PM_GroupBox} @param title: The title (button) text. If empty, no title is added. @type title: str @param connectTitleButton: If True, this class will automatically connect the title button of the groupbox to send signal to expand or collapse the groupbox. Otherwise, the caller has to connect this signal by itself. See: B{Ui_MovePropertyManager.addGroupBoxes} and B{MovePropertyManager.connect_or_disconnect_signals} for examples where the client connects this slot. @type connectTitleButton: bool @param setAsDefault: If False, no widgets in this group box will have thier default values restored when the B{Restore Defaults} button is clicked, regardless thier own I{setAsDefault} value. @type setAsDefault: bool @see: U{B{QGroupBox}<http://doc.trolltech.com/4/qgroupbox.html>} """ QGroupBox.__init__(self) self.parentWidget = parentWidget # Calling addWidget() here is important. If done at the end, # the title button does not get assigned its palette for some # unknown reason. Mark 2007-05-20. # Add self to PropMgr's vBoxLayout if parentWidget: parentWidget._groupBoxCount += 1 parentWidget.vBoxLayout.addWidget(self) parentWidget._widgetList.append(self) _groupBoxCount = 0 self._widgetList = [] self._title = title self.setAsDefault = setAsDefault self.setAutoFillBackground(True) self.setStyleSheet(self._getStyleSheet()) # Create vertical box layout which will contain two widgets: # - the group box title button (or title) on row 0. # - the container widget for all PM widgets on row 1. self._vBoxLayout = QVBoxLayout(self) self._vBoxLayout.setMargin(0) self._vBoxLayout.setSpacing(0) # _containerWidget contains all PM widgets in this group box. # Its sole purpose is to easily support the collapsing and # expanding of a group box by calling this widget's hide() # and show() methods. self._containerWidget = QWidget() self._vBoxLayout.insertWidget(0, self._containerWidget) # Create vertical box layout self.vBoxLayout = QVBoxLayout(self._containerWidget) self.vBoxLayout.setMargin(PM_GROUPBOX_VBOXLAYOUT_MARGIN) self.vBoxLayout.setSpacing(PM_GROUPBOX_VBOXLAYOUT_SPACING) # Create grid layout self.gridLayout = QGridLayout() self.gridLayout.setMargin(PM_GRIDLAYOUT_MARGIN) self.gridLayout.setSpacing(PM_GRIDLAYOUT_SPACING) # Insert grid layout in its own vBoxLayout self.vBoxLayout.addLayout(self.gridLayout) # Add title button (or just a title if the parent is not a PM_Dialog). if not parentWidget or isinstance(parentWidget, PM_GroupBox): self.setTitle(title) else: # Parent is a PM_Dialog, so add a title button. if not self.titleButtonRequested: self.setTitle(title) else: self.titleButton = self._getTitleButton(self, title) self._vBoxLayout.insertWidget(0, self.titleButton) if connectTitleButton: self.connect( self.titleButton, SIGNAL("clicked()"), self.toggleExpandCollapse) self._insertMacSpacer() # Fixes the height of the group box. Very important. Mark 2007-05-29 self.setSizePolicy( QSizePolicy(QSizePolicy.Policy(QSizePolicy.Preferred), QSizePolicy.Policy(QSizePolicy.Fixed))) self._addBottomSpacer() return