def initControls(self): """ initControls() -> create the plot controls """ series = self.series connect = self.connect labels = self.pointLabels self.controlsBox = controlsbox = qt.QVBox(self) self.controlsGrid = controlsgrid = qt.QGrid(2, controlsbox) self.plotSplitter = qt.QSplitter(qt.Qt.Vertical, self) controlsgrid.setSpacing(self.gridSpacing) controlsgrid.setMargin(self.gridMargin) smap = [(self.seriesKey, series), ] + series.index_map.items() smap = [(k, v) for k, v in smap if hasattr(v, 'plot_style')] for key, seq in smap: style = getPlotStyle(seq) curve_check = CurveToggleCheckBox(controlsgrid, key) curve_color = CurveColorPickButton(controlsgrid, style.color, key) connect(curve_check, plotControlToggle, self.toggleCurveVisibility) connect(curve_color, plotControlColorSelected, self.setCurveColor) self.curveTools[key] = (curve_check, curve_color) for key in self.plotKeys: for side in self.trackingSides: labels[key][side] = TrackingPointLabel(controlsbox, side) lastlabel = qt.QFrame(controlsbox) controlsbox.setStretchFactor(lastlabel, 100) self.series_map = dict(smap)
def __init__(self, parent=None): self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("Package Priority")) self._window.setModal(True) #self._window.setMinimumSize(600, 400) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() self._vbox = vbox self._table = qt.QGrid(2, vbox) self._table.setSpacing(10) self._table.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(_("Close"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("hide()")) self._vbox.adjustSize() self._window.adjustSize()
def __init__(self, parent=None): self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("New Package Priority")) self._window.setModal(True) #self._window.setMinimumSize(600, 400) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() table = qt.QGrid(2, vbox) table.setSpacing(10) table.show() label = qt.QLabel(_("Package Name:"), table) self._name = qt.QLineEdit(table) self._name.show() label = qt.QLabel(_("Channel Alias:"), table) self._alias = qt.QLineEdit(table) self._alias.setText("*") self._alias.show() label = qt.QLabel(_("Priority:"), table) self._priority = qt.QSpinBox(table) self._priority.setSteps(1, 10) self._priority.setRange(-100000,+100000) self._priority.show() sep = qt.QFrame(vbox) sep.setFrameShape(qt.QFrame.HLine) sep.setFrameShadow(qt.QFrame.Sunken) sep.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(_("Cancel"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()")) button = qt.QPushButton(_("OK"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()")) button.setDefault(True) vbox.adjustSize() self._window.adjustSize()
def __init__(self, parent=None): qt.QDialog.__init__(self, parent) self.setIcon(getPixmap("smart")) self.setCaption(_("Icon Legend")) layout = qt.QVBoxLayout(self) self._vbox = qt.QVBox(self) self._vbox.setMargin(10) self._vbox.setSpacing(10) layout.add(self._vbox) label = qt.QLabel("<b>" + _("The following icons are used to indicate\nthe current status of a package:") + "</b>", self._vbox) label.show() grid = qt.QGrid(2, self._vbox) grid.setSpacing(5) grid.setMargin(5) grid.show() for icon, legend in [ (getPixmap("package-install"), _("Marked for installation")), (getPixmap("package-reinstall"), _("Marked for re-installation")), (getPixmap("package-upgrade"), _("Marked for upgrade")), (getPixmap("package-downgrade"), _("Marked for downgrade")), (getPixmap("package-remove"), _("Marked for removal")), (getPixmap("package-available"), _("Not installed")), (getPixmap("package-new"), _("Not installed (new)")), (getPixmap("package-available-locked"), _("Not installed (locked)")), (getPixmap("package-installed"), _("Installed")), (getPixmap("package-installed-outdated"), _("Installed (upgradable)")), (getPixmap("package-installed-locked"), _("Installed (locked)")), (getPixmap("package-broken"), _("Broken")), ]: image = qt.QLabel("", grid) image.setPixmap(icon) image.show() label = qt.QLabel(legend, grid) label.show() self._buttonbox = qt.QHBox(self._vbox) self._buttonbox.setSpacing(10) self._buttonbox.layout().addStretch(1) self._buttonbox.show() self._closebutton = qt.QPushButton(_("Close"), self._buttonbox) self._closebutton.show() qt.QObject.connect(self._closebutton, qt.SIGNAL("clicked()"), self, qt.SLOT("hide()"))
def __init__(self, parent=None): self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("New Target")) self._window.setModal(True) #self._window.setMinimumSize(600, 400) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() table = qt.QGrid(2, vbox) table.setSpacing(10) table.show() label = qt.QLabel(_("Target:"), table) self._target = qt.QLineEdit(table) self._target.setMaxLength(40) self._target.show() blank = qt.QWidget(table) label = qt.QLabel( _("Examples: \"pkgname\", \"pkgname = 1.0\" or " "\"pkgname <= 1.0\""), table) sep = qt.QFrame(vbox) sep.setFrameShape(qt.QFrame.HLine) sep.setFrameShadow(qt.QFrame.Sunken) sep.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(bbox.tr("OK"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()")) button = qt.QPushButton(bbox.tr("Cancel"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()")) vbox.adjustSize() self._window.adjustSize()
def __init__(self, *args, **kwargs): qt.QWidget.__init__(self, *args) self.configuration = Configuration.Configuration() self.setCaption("GUI Editor") tb = qt.QHBox(self) toolsBox = qt.QGrid(6, tb) HorizontalSpacer(tb) toolsBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed) self.cmdAddWindow = ToolButton(toolsBox, "window_new", self.addWindow, "add a new window (container)") self.cmdAddTab=ToolButton(toolsBox, "tab", self.addTab, "add a new tab (container)") self.cmdAddHBox=ToolButton(toolsBox, "add_hbox", self.addHBox, "add a new horizontal box (container)") self.cmdAddVBox=ToolButton(toolsBox, "add_vbox", self.addVBox, "add a new vertical box (container)") self.cmdAddHGroupBox=ToolButton(toolsBox, "hgroupbox", self.addHGroupBox, "add a new horizontal group box (container)") self.cmdAddVGroupBox=ToolButton(toolsBox, "vgroupbox", self.addVGroupBox, "add a new vertical group box (container)") self.cmdAddHSpacer=ToolButton(toolsBox, "add_hspacer", self.addHSpacer, "add a new horizontal spacer") self.cmdAddVSpacer=ToolButton(toolsBox, "add_vspacer", self.addVSpacer, "add a new vertical spacer") self.cmdAddHSplitter=ToolButton(toolsBox, "hsplitter", self.addHSplitter, "add a new horizontal splitter (container)") self.cmdAddVSplitter=ToolButton(toolsBox, "vsplitter", self.addVSplitter, "add a new vertical splitter (container)") self.cmdAddIcon=ToolButton(toolsBox, "icon", self.addIcon, "add a new icon") self.cmdAddLabel=ToolButton(toolsBox, "label", self.addLabel, "add a new label") treeHandlingBox = qt.QHBox(self) treeHandlingBox.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Fixed) self.cmdShowConnections=ToolButton(treeHandlingBox, "connect_creating", self.showConnections, "manage connections between items") HorizontalSpacer(treeHandlingBox,size=20) self.cmdMoveUp=ToolButton(treeHandlingBox, "Up2", self.moveUp, "move an item up") self.cmdMoveDown=ToolButton(treeHandlingBox, "Down2", self.moveDown, "move an item down") HorizontalSpacer(treeHandlingBox, size=10) self.cmdRemoveItem=ToolButton(treeHandlingBox, "delete_small", self.removeItem, "delete an item") HorizontalSpacer(treeHandlingBox) self.treeLayout = GUIListView(self) self.rootElement = qt.QListViewItem(self.treeLayout, "GUI tree", "") self.rootElement.setOpen(True) qt.QObject.connect(self.treeLayout, qt.SIGNAL('selectionChanged(QListViewItem *)'), self.itemSelected) qt.QObject.connect(self.treeLayout, qt.SIGNAL('doubleClicked(QListViewItem *, const QPoint &, int)'), self.itemDoubleClicked) qt.QObject.connect(self.treeLayout, qt.SIGNAL('itemRenamed(QListViewItem *, int)'), self.itemRenamed) qt.QObject.connect(self.treeLayout, qt.PYSIGNAL('dragdrop'), self.itemDragDropped) qt.QObject.connect(self.treeLayout, qt.PYSIGNAL('contextMenuRequested'), self.itemRightClicked) qt.QVBoxLayout(self, 0, 10) self.layout().addWidget(tb) self.layout().addWidget(treeHandlingBox) self.layout().addWidget(self.treeLayout)
def __init__(self): qt.QVBox.__init__(self) self.button = qt.QPushButton('Reset', self) self.connect(self.button, qt.SIGNAL("clicked()"), self.load) self.button2 = qt.QPushButton(self) self.connect(self.button2, qt.SIGNAL("clicked()"), self.change) hbox = qt.QGrid(2, self) lbl1 = qt.QLabel("Edit Panel", hbox) lbl2 = qt.QLabel("Clipboard", hbox) lbl1.setMargin(2) lbl1.setAlignment(lbl1.AlignCenter) lbl2.setAlignment(lbl1.AlignCenter) self.treeview = TreeEdit(hbox) self.clipboard = TreeEdit(hbox) self.root = None self.load() self.resize(400, 450)
def __init__(self, parent=None): self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("New Channel")) self._window.setModal(True) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() self._vbox = vbox table = qt.QGrid(2, vbox) table.setSpacing(10) table.show() self._table = table label = qt.QLabel(_("Type:"), table) self._typevbox = qt.QVButtonGroup(table) self._typevbox.setFrameStyle(qt.QFrame.NoFrame) self._typevbox.show() sep = qt.QFrame(vbox) sep.setFrameShape(qt.QFrame.HLine) sep.setFrameShadow(qt.QFrame.Sunken) sep.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(_("Cancel"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()")) button = qt.QPushButton(_("OK"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()")) self._ok = button self._ok.setEnabled(False)
def __init__(self, parent=None): self._fields = {} self._fieldn = 0 self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("Edit Channel")) self._window.setModal(True) layout = qt.QVBoxLayout(self._window) layout.setResizeMode(qt.QLayout.FreeResize) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() layout.addWidget(vbox) self._vbox = vbox self._table = qt.QGrid(2, vbox) self._table.setSpacing(10) self._table.show() sep = qt.QFrame(vbox) sep.setFrameShape(qt.QFrame.HLine) sep.setFrameShadow(qt.QFrame.Sunken) sep.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(_("Cancel"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()")) button = qt.QPushButton(_("OK"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()")) button.setDefault(True)
def show(self, pkg): priority = sysconf.get(("package-priorities", pkg.name), {}) table = self._table #table.foreach(table.remove) label = qt.QLabel(_("Package:"), table) label.show() label = qt.QLabel("<b>%s</b>" % pkg.name, table) label.show() class AliasCheckBox(qt.QCheckBox): def __init__(self, name, parent): qt.QSpinBox.__init__(self, name, parent) def connect(self, signal, slot, spin, alias): qt.QObject.connect(self, qt.SIGNAL(signal), slot) self._spin = spin self._alias = alias def toggled(self, check): spin = self._spin alias = self._alias if check: priority[alias] = int(spin.value()) spin.setEnabled(True) else: if alias in priority: del priority[alias] spin.setEnabled(False) class AliasSpinBox(qt.QSpinBox): def __init__(self, parent): qt.QSpinBox.__init__(self, parent) def connect(self, signal, slot, alias): qt.QObject.connect(self, qt.SIGNAL(signal), slot) self._alias = alias def value_changed(self, value): alias = spin._alias priority[alias] = value label = qt.QLabel(_("Default priority:"), table) label.show() hbox = qt.QHBox(table) hbox.setSpacing(10) hbox.show() radio = qt.QRadioButton(_("Channel default"), hbox) radio.setChecked(None not in priority) radio.show() radio = qt.QRadioButton(_("Set to"), hbox) radio.setChecked(None in priority) radio.show() spin = qt.QSpinBox(hbox) spin.setSteps(1, 10) spin.setRange(-100000,+100000) spin.setValue(priority.get(None, 0)) spin.show() label = qt.QLabel(_("Channel priority:"), table) label.show() chantable = qt.QGrid(2, table) chantable.setSpacing(10) chantable.show() pos = 0 channels = sysconf.get("channels") for alias in channels: channel = channels[alias] if not getChannelInfo(channel.get("type")).kind == "package": continue name = channel.get("name") if not name: name = alias check = AliasCheckBox(name, chantable) check.setChecked(alias in priority) check.show() spin = AliasSpinBox(chantable) if alias not in priority: spin.setEnabled(False) spin.setSteps(1, 10) spin.setRange(-100000,+100000) spin.setValue(priority.get(alias, 0)) spin.connect("valueChanged(int)", spin.value_changed, alias) check.connect("toggled(bool)", check.toggled, spin, alias) spin.show() pos += 1 table.adjustSize() self._vbox.adjustSize() self._window.adjustSize() self._window.show() self._window.raiseW() self._window.setActiveWindow() self._window.exec_loop() self._window.hide() if not priority: sysconf.remove(("package-priorities", pkg.name)) else: sysconf.set(("package-priorities", pkg.name), priority)
def __init__(self, parent): qt.QTabWidget.__init__(self, parent) self._pkg = None self._changeset = None self._tabwidget = self self._tabwidget.show() sv = BackgroundScrollView(self._tabwidget) sv.setMargin(5) sv.show() grid = qt.QGrid(2, sv.viewport()) grid.setSpacing(5) grid.setMargin(5) grid.show() sv.addChild(grid) self._info = type("Info", (), {})() row = 1 for attr, text in [("status", _("Status:")), ("priority", _("Priority:")), ("group", _("Group:")), ("installedsize", _("Installed Size:")), ("channels", _("Channels:")), ("reference", _("Reference URLs:"))]: label = qt.QLabel(text, grid) label.show() setattr(self._info, attr + "_label", label) label = qt.QLabel("", grid) label.show() setattr(self._info, attr, label) row += 1 self._grid = grid self._grid.adjustSize() self._tabwidget.addTab(sv, _("General")) sv = BackgroundScrollView(self._tabwidget) sv.setMargin(5) sv.show() self._descr = qt.QLabel(sv.viewport()) self._descr.setAlignment(qt.Qt.AlignTop) self._descr.show() sv.addChild(self._descr) self._descr.adjustSize() self._tabwidget.addTab(sv, _("Description")) sv = BackgroundScrollView(self._tabwidget) sv.setVScrollBarMode(qt.QScrollView.AlwaysOn) sv.setMargin(5) sv.show() self._cont = qt.QLabel(sv.viewport()) self._cont.setAlignment(qt.Qt.AlignTop) self._cont.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self._cont.show() sv.addChild(self._cont) self._cont.adjustSize() self._tabwidget.addTab(sv, _("Content")) sv = BackgroundScrollView(self._tabwidget) sv.setVScrollBarMode(qt.QScrollView.AlwaysOn) sv.setMargin(5) sv.show() self._change = qt.QLabel(sv.viewport()) self._change.setAlignment(qt.Qt.AlignTop) self._change.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self._change.show() sv.addChild(self._change) self._change.adjustSize() self._tabwidget.addTab(sv, _("Changelog")) self._relations = QtPackageView(self._tabwidget) self._relations.getTreeView().header().hide() self._relations.show() self._tabwidget.addTab(self._relations, _("Relations")) self._urls = qt.QListView(self._tabwidget) self._urls.setSizePolicy(qt.QSizePolicy.Expanding, qt.QSizePolicy.Expanding) self._urls.setAllColumnsShowFocus(True) self._urls.header().hide() self._urls.show() self._urls.addColumn(_("Channel")) self._urls.addColumn(_("Size")) self._urls.addColumn(_("URL")) self._tabwidget.addTab(self._urls, _("URLs")) self._tabwidget.adjustSize() qt.QObject.connect(self._tabwidget, qt.SIGNAL("currentChanged(QWidget *)"), self._currentChanged)
def __init__(self, parent=None): self._window = qt.QDialog(parent) self._window.setIcon(getPixmap("smart")) self._window.setCaption(_("New Channel")) self._window.setModal(True) vbox = qt.QVBox(self._window) vbox.setMargin(10) vbox.setSpacing(10) vbox.show() table = qt.QGrid(1, vbox) table.setSpacing(10) table.show() label = qt.QLabel(_("Method:"), table) methodvbox = qt.QVButtonGroup(table) methodvbox.show() sep = qt.QFrame(vbox) sep.setFrameShape(qt.QFrame.HLine) sep.setFrameShadow(qt.QFrame.Sunken) sep.show() bbox = qt.QHBox(vbox) bbox.setSpacing(10) bbox.layout().addStretch(1) bbox.show() button = qt.QPushButton(_("Cancel"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("reject()")) button = qt.QPushButton(_("OK"), bbox) qt.QObject.connect(button, qt.SIGNAL("clicked()"), self._window, qt.SLOT("accept()")) self._ok = button self._ok.setEnabled(False) self._method = None for method, descr in [ ("manual", _("Provide channel information")), ("descriptionpath", _("Read channel description from local path")), ("descriptionurl", _("Read channel description from URL")), ("detectmedia", _("Detect channel in media (CDROM, DVD, etc)")), ("detectpath", _("Detect channel in local path")) ]: if not self._method: self._method = method radio = qt.QRadioButton(descr, methodvbox, method) qt.QObject.connect(radio, qt.SIGNAL("clicked()"), self.ok) act = RadioAction(radio, method, descr) act.connect(self, "_method", method) radio.show() methodvbox.adjustSize() vbox.adjustSize() self._window.adjustSize()