def show(self): self.fill() self._window.show() centerWindow(self._window) self._window.raise_() self._window.exec_() self._window.hide()
def show(self, msg): self._label.setText(msg) self._vbox.adjustSize() self._window.adjustSize() self._window.show() centerWindow(self._window) self._lastshown = time.time() while QtCore.QEventLoop().isRunning(): QtCore.QEventLoop().processEvents(QtGui.QEventLoop.AllEvents)
def show(self, msg): self._label.setText(msg) self._vbox.adjustSize() self._window.adjustSize() self._window.show() centerWindow(self._window) self._lastshown = time.time() while QtGui.QApplication.eventLoop().hasPendingEvents(): QtGui.QApplication.eventLoop().processEvents(QtGui.QEventLoop.AllEvents)
def show(self): self.fill() self._vbox.adjustSize() self._window.show() centerWindow(self._window) self._window.raise_() self._window.activateWindow() self._window.exec_() self._window.hide() self.enableDisable() return self._changed
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowIcon(QtGui.QIcon(getPixmap("smart"))) self.setWindowTitle(_("Change Summary")) self.setModal(True) self.setMinimumSize(600, 400) centerWindow(self) self._vbox = QtGui.QVBoxLayout(self) self._vbox.setMargin(10) self._vbox.setSpacing(10) self._label = QtGui.QLabel(self) self._vbox.addWidget(self._label) self._pv = QtPackageView(self) self._pv.getTreeView().header().hide() self._pv.setExpandPackage(True) self._pv.show() self._vbox.addWidget(self._pv) self._sizelabel = QtGui.QLabel("", self) self._vbox.addWidget(self._sizelabel) self._confirmbbox = QtGui.QWidget(self) layout = QtGui.QHBoxLayout(self._confirmbbox) layout.setSpacing(10) layout.addStretch(1) self._vbox.addWidget(self._confirmbbox) self._cancelbutton = QtGui.QPushButton(_("Cancel"), self._confirmbbox) QtCore.QObject.connect(self._cancelbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()")) self._okbutton = QtGui.QPushButton(_("OK"), self._confirmbbox) QtCore.QObject.connect(self._okbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("accept()")) self._closebbox = QtGui.QWidget(self) layout = QtGui.QHBoxLayout(self._closebbox) layout.setSpacing(10) layout.addStretch(1) self._vbox.addWidget(self._closebbox) self._closebutton = QtGui.QPushButton(_("Close"), self._closebbox) QtCore.QObject.connect(self._closebutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("close()"))
def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) self.setWindowIcon(QtGui.QIcon(getPixmap("smart"))) self.setWindowTitle(_("Change Summary")) self.setModal(True) self.setMinimumSize(600, 400) centerWindow(self) self._vbox = QtGui.QVBoxLayout(self) self._vbox.setMargin(10) self._vbox.setSpacing(10) self._label = QtGui.QLabel(self) self._vbox.addWidget(self._label) self._pv = QtPackageView(self) self._pv.getTreeView().header().hide() self._pv.setExpandPackage(True) self._pv.show() self._vbox.addWidget(self._pv) self._sizelabel = QtGui.QLabel("", self) self._vbox.addWidget(self._sizelabel) self._confirmbbox = QtGui.QWidget(self) layout = QtGui.QHBoxLayout(self._confirmbbox) layout.setSpacing(10) layout.addStretch(1) self._vbox.addWidget(self._confirmbbox) self._cancelbutton = QtGui.QPushButton(_("Cancel"), self._confirmbbox) QtCore.QObject.connect( self._cancelbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("reject()")) self._okbutton = QtGui.QPushButton(_("OK"), self._confirmbbox) QtCore.QObject.connect( self._okbutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("accept()")) self._closebbox = QtGui.QWidget(self) layout = QtGui.QHBoxLayout(self._closebbox) layout.setSpacing(10) layout.addStretch(1) self._vbox.addWidget(self._closebbox) self._closebutton = QtGui.QPushButton(_("Close"), self._closebbox) QtCore.QObject.connect( self._closebutton, QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("close()"))
def show(self): self.fill() self._result = False self._treeview.adjustSize() self._window.show() centerWindow(self._window) self._window.raise_() self._result = self._window.exec_() self._window.hide() result = [] if self._result == QtGui.QDialog.Accepted: iter = 0 while iter < self._treeview.rowCount(): item = self._treeview.itemAt(iter, 0) if item.checkState() == QtCore.Qt.Checked: result.append(item.text(1)) iter += 1 return result
def __init__(self, ctrl, argv=None): QtInterface.__init__(self, ctrl, argv) self._changeset = None self._window = QtGui.QMainWindow() self._window.setWindowTitle("Smart Package Manager %s" % VERSION) centerWindow(self._window) self._window.setMinimumSize(640, 480) app.connect(app, QtCore.SIGNAL('lastWindowClosed()'), app, QtCore.SLOT('quit()')) self._undo = [] self._redo = [] globals = {"self": self, "QtGui": QtGui, "QtCore": QtCore} #group = QtGui.QActionGroup(self._window, "Actions") group = QtGui.QActionGroup(self._window) self._actions = compileActions(group, ACTIONS, globals) class ToggleAction(QtGui.QAction): def __init__(self, group, name, label): QtGui.QAction.__init__(self, name, group) #self.setToggleAction(True) self.setCheckable(True) self.setText(label.replace("&","&&")) self._name = name def connect(self, signal, callback, userdata): self._callback = callback self._userdata = userdata QtCore.QObject.connect(self, QtCore.SIGNAL(signal), self.slot) def slot(self): self._callback(self._userdata) self._filters = {} for name, label in [("hide-non-upgrades", _("Hide Non-upgrades")), ("hide-installed", _("Hide Installed")), ("hide-uninstalled", _("Hide Uninstalled")), ("hide-unmarked", _("Hide Unmarked")), ("hide-unlocked", _("Hide Unlocked")), ("hide-requested", _("Hide Requested")), ("hide-old", _("Hide Old"))]: act = ToggleAction(None, name, label) act.connect("activated()", self.toggleFilter, name) self._actions[name] = act treestyle = sysconf.get("package-tree") for name, label in [("groups", _("Groups")), ("channels", _("Channels")), ("channels-groups", _("Channels & Groups")), ("none", _("None"))]: act = ToggleAction(group, "tree-style-"+name, label) if name == treestyle: act.setChecked(True) act.connect("activated()", self.setTreeStyle, name) self._actions["tree-style-"+name] = act self._menubar = self._window.menuBar() for MENU in MENUBAR: def insertmenu(menubar, menu): item = menu[0] action = self._actions[item] m = QtGui.QMenu(menubar) m.setTitle(action.text()) menubar.addMenu(m) for item in menu[1]: if isinstance(item, tuple): insertmenu(m, item) elif item: action = self._actions[item] #i = QtGui.QPopupMenu(m) i = QtGui.QMenu(m) #text = action.menuText() i.setTitle(action.text()) #m.insertItem(text, i) #action.addTo(m) m.addAction(action) else: m.addSeparator() insertmenu(self._menubar, MENU) self._toolbar = QtGui.QToolBar(self._window) for TOOL in TOOLBAR: def inserttool(toolbar, tool): if tool: action = self._actions[tool] pixmap = getPixmap(TOOLBARICONS[tool]) action.setIcon(QtGui.QIcon(pixmap)) toolbar.addAction(action) else: toolbar.addSeparator() inserttool(self._toolbar, TOOL) self._window.addToolBar( self._toolbar) #self._window.add_accel_group(self._ui.get_accel_group()) self._actions["exec-changes"].setShortcut(QtGui.QKeySequence("Ctrl+C")) self._actions["find"].setShortcut(QtGui.QKeySequence("Ctrl+F")) self._actions["expand-all"].setShortcut(QtGui.QKeySequence("Ctrl+O")) self._actions["collapse-all"].setShortcut(QtGui.QKeySequence("Ctrl+W")) self._actions["summary-window"].setShortcut(QtGui.QKeySequence("Ctrl+S")) self._actions["exec-changes"].setEnabled(False) self._actions["clear-changes"].setEnabled(False) self._actions["undo"].setEnabled(False) self._actions["redo"].setEnabled(False) # Search bar self._searchbar = QtGui.QToolBar(self._window) self._searchbar.hide() self._window.addToolBar(self._searchbar) label = QtGui.QLabel(_("Search:"), self._searchbar) label.show() self._searchbar.addWidget(label) self._searchentry = QtGui.QLineEdit(self._searchbar) QtCore.QObject.connect(self._searchentry, QtCore.SIGNAL("returnPressed()"), self.refreshPackages) self._searchentry.show() self._searchbar.addWidget(self._searchentry) button = QtGui.QPushButton(self._searchbar) QtCore.QObject.connect(button, QtCore.SIGNAL("clicked()"), self.refreshPackages) pixmap = getPixmap("crystal-search") button.setIcon(QtGui.QIcon(pixmap)) button.show() self._searchbar.addWidget(button) buttongroup = QtGui.QButtonGroup(self._searchbar) #buttongroup.hide() self._searchname = QtGui.QRadioButton(_("Automatic"), self._searchbar) self._searchname.setChecked(True) QtCore.QObject.connect(self._searchname, QtCore.SIGNAL("clicked()"), self.refreshPackages) buttongroup.addButton(self._searchname) self._searchbar.addWidget(self._searchname) self._searchname.show() self._searchdesc = QtGui.QRadioButton(_("Description"), self._searchbar) self._searchdesc.setChecked(False) QtCore.QObject.connect(self._searchdesc, QtCore.SIGNAL("clicked()"), self.refreshPackages) self._searchdesc.show() buttongroup.addButton(self._searchdesc) self._searchbar.addWidget(self._searchdesc) # Packages and information self._splitter = QtGui.QSplitter(QtCore.Qt.Vertical, self._window) self._window.setCentralWidget(self._splitter) self._pv = QtPackageView(self._splitter) self._pv.show() self._pi = QtPackageInfo(self._splitter) self._pi.show() QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageSelected"), self._pi.setPackage) QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packageActivated"), self.actOnPackages) QtCore.QObject.connect(self._pv, QtCore.SIGNAL("packagePopup"), self.packagePopup) self._status = self._window.statusBar() self._status.show() self._legend = QtLegend(self._window)
def expose(self, topic, percent, subkey, subtopic, subpercent, data, done): if self._currentThread() != self._mainthread: # Note: it's NOT safe to use Qt from threads other than main return QtGui.QDialog.show(self) if not self._beenshown: centerWindow(self) self._beenshown = True self.raise_() if self._hassub and subkey: if subkey in self._subiters: iter = self._subiters[subkey] else: row = self._listview.rowCount() self._listview.insertRow(row) iter = [] iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 0, iter[0]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 1, iter[1]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 2, iter[2]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 3, iter[3]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 4, iter[4]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 5, iter[5]) self._subiters[subkey] = iter #self._listview.ensureItemVisible(iter) current = data.get("current", "") if current: self._listview.setColumnWidth(self._currentcolumn, 110) total = data.get("total", "") if total: self._listview.setColumnWidth(self._totalcolumn, 110) if done: speed = "" eta = "" subpercent = 100 else: speed = data.get("speed", "") if speed: self._listview.setColumnWidth(self._speedcolumn, 110) eta = data.get("eta", "") if eta: self._listview.setColumnWidth(self._etacolumn, 110) if current or total or speed or eta: iter[1].setText(current) iter[2].setText(total) iter[3].setText(speed) iter[4].setText(eta) subtopic = self._shorturl.get(subtopic) iter[0].setText(str(subpercent) + "%") iter[5].setText(subtopic) #iter.widthChanged(self._desccolumn) else: self._topic.setText('<b>'+topic+'</b>') self._progressbar.setValue(percent) if self._hassub: self._listview.update() while QtGui.QCoreApplication.instance().hasPendingEvents(): QtGui.QCoreApplication.instance().processEvents()
def expose(self, topic, percent, subkey, subtopic, subpercent, data, done): if self._currentThread() != self._mainthread: # Note: it's NOT safe to use Qt from threads other than main return QtGui.QDialog.show(self) if not self._beenshown: centerWindow(self) self._beenshown = True self.raise_() if self._hassub and subkey: if subkey in self._subiters: iter = self._subiters[subkey] else: row = self._listview.rowCount() self._listview.insertRow(row) iter = [] iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 0, iter[0]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 1, iter[1]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 2, iter[2]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 3, iter[3]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 4, iter[4]) iter.append(QtGui.QTableWidgetItem()) self._listview.setItem(row, 5, iter[5]) self._subiters[subkey] = iter #self._listview.ensureItemVisible(iter) current = data.get("current", "") if current: self._listview.setColumnWidth(self._currentcolumn, 110) total = data.get("total", "") if total: self._listview.setColumnWidth(self._totalcolumn, 110) if done: speed = "" eta = "" subpercent = 100 else: speed = data.get("speed", "") if speed: self._listview.setColumnWidth(self._speedcolumn, 110) eta = data.get("eta", "") if eta: self._listview.setColumnWidth(self._etacolumn, 110) if current or total or speed or eta: iter[1].setText(current) iter[2].setText(total) iter[3].setText(speed) iter[4].setText(eta) subtopic = self._shorturl.get(subtopic) iter[0].setText(str(subpercent) + "%") iter[5].setText(subtopic) #iter.widthChanged(self._desccolumn) else: self._topic.setText('<b>' + topic + '</b>') self._progressbar.setValue(percent) if self._hassub: self._listview.update() while QtGui.QApplication.instance().hasPendingEvents(): QtGui.QApplication.instance().processEvents()