def __init__(self, package, parent, item): QtWidgets.QWidget.__init__(self, None) self.ui = Ui_ServiceItemWidget() self.ui.setupUi(self) self.busy = QProgressIndicator(self) self.busy.setMinimumSize(QtCore.QSize(32, 32)) self.ui.mainLayout.insertWidget(0, self.busy) self.ui.spacer.hide() self.busy.hide() self.ui.labelName.setText(package) self.toggleButtons() self.ui.buttonStart.setIcon(KIcon("media-playback-start")) self.ui.buttonStop.setIcon(KIcon("media-playback-stop")) self.ui.buttonReload.setIcon(KIcon("view-refresh")) self.ui.buttonInfo.setIcon(KIcon("dialog-information")) self.toggled = False self.root = parent self.iface = parent.iface self.item = item self.package = package self.info = ServiceItemInfo(self) self.type = None self.desc = None self.ui.buttonStart.clicked.connect(self.setService) self.ui.buttonStop.clicked.connect(self.setService) self.ui.buttonReload.clicked.connect(self.setService) self.ui.checkStart.clicked.connect(self.setService) self.ui.buttonInfo.clicked.connect(self.info.showDescription)
def __init__(self, parent, id_, title="", description="", type_=None, icon=None, state=None): QtWidgets.QWidget.__init__(self, parent) self.setupUi(self) self.id = id_ self.type = type_ self.setTitle(title) self.setDescription(description) if icon: self.setIcon(icon) else: self.labelIcon.hide() if state != None: self.setState(state) else: self.checkState.hide() # Buttons self.pushEdit.setIcon(KIcon("preferences-other")) self.pushDelete.setIcon(KIcon("edit-delete")) # Signals self.checkState.stateChanged[int].connect( lambda: self.stateChanged[int].emit(self.checkState.checkState())) self.pushEdit.clicked.connect(lambda: self.editClicked.emit()) self.pushDelete.clicked.connect(lambda: self.deleteClicked.emit())
def detect_dir_icon(self, root): """Detectar si el directorio tiene un icono, y si es afirmativo, devolver la ruta del mismo. """ if not os.path.exists(root): return False # KDE if '.directory' in os.listdir(root): # .directory es un archivo de meta-datos que se encuentra dentro del # directorio con información sobre el mismo, uno de los datos posibles # es el icono. data = open(os.path.join(root, '.directory')).read() icon = re.findall('Icon=(.+)', data, re.MULTILINE) if not icon: return False icon = icon[0] if not icon.startswith('/') and pykde_available: # El icono no es una ruta al icono, sino el nombre del mismo, y se # necesita obtener del directorio del tema de iconos del sistema. if not KIcon.hasThemeIcon(icon): return False theme = str(KIcon.themeName()) path = '/tmp/%s:%s.png' % (theme, icon) if not os.path.exists(path): KIcon(icon).pixmap(QSize(64, 64)).save(path) return path if not icon.startswith('/') and not pykde_available: # Es como el caso anterior un nombre del icono, pero no se posee # el directorio de iconos, por lo que el proceso fallará return False else: # Es una ruta al icono, se devuelve return icon return False
def build_menu(self): if ConfigManager.SETTINGS[SHOW_TRAY_ICON]: # Get phrase folders to add to main menu folders = [] items = [] for folder in self.configManager.allFolders: if folder.showInTrayMenu: folders.append(folder) for item in self.configManager.allItems: if item.showInTrayMenu: items.append(item) # Construct main menu menu = popupmenu.PopupMenu(self.app.service, folders, items, False, "AutoKey") if len(items) > 0: menu.addSeparator() self.toggleAction = KToggleAction(i18n("&Enable Monitoring"), menu) self.toggleAction.connect(self.toggleAction, SIGNAL("triggered()"), self.on_enable_toggled) self.toggleAction.setChecked(self.app.service.is_running()) self.toggleAction.setEnabled(not self.app.serviceDisabled) menu.addAction(self.toggleAction) menu.addAction(KIcon("edit-clear"), i18n("&Hide Icon"), self.on_hide_icon) menu.addAction(KIcon("configure"), i18n("&Show Main Window"), self.on_configure) menu.addAction(KStandardAction.quit(self.on_quit, menu)) self.icon.setContextMenu(menu)
def __init__(self, parent, id_, title="", description="", type_=None, icon=None, state=None): QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.id = id_ self.type = type_ self.setTitle(title) self.setDescription(description) if icon: self.setIcon(icon) else: self.labelIcon.hide() if state != None: self.setState(state) else: self.radioState.hide() # Buttons self.pushEdit.setIcon(KIcon("preferences-other")) self.pushDelete.setIcon(KIcon("edit-delete")) # Signals self.connect(self.radioState, QtCore.SIGNAL("toggled(bool)"),lambda: self.emit(QtCore.SIGNAL("toggled(bool)"), self.radioState.isChecked())) self.connect(self.pushEdit, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("editClicked()"))) self.connect(self.pushDelete, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("deleteClicked()")))
def match(self, context): if not context.isValid(): return query = context.query() search = query.__str__() # PyQt is shit if len(search) < 3: return if search.lower() in 'create note': action = Plasma.QueryMatch(self.runner) action.setText("Create new note in everpad") action.setType(Plasma.QueryMatch.ExactMatch) action.setIcon(KIcon("everpad")) action.setData(str(CREATE)) context.addMatch(query, action) if search.lower() in 'settings and management': action = Plasma.QueryMatch(self.runner) action.setText("Open everpad settings") action.setType(Plasma.QueryMatch.ExactMatch) action.setIcon(KIcon("everpad")) action.setData(str(SETTINGS)) context.addMatch(query, action) blank = dbus.Array([], signature='i') for note_struct in provider.find_notes( search, blank, blank, 0, 1000, Note.ORDER_TITLE, -1, ): note = Note.from_tuple(note_struct) action = Plasma.QueryMatch(self.runner) action.setText(note.title) action.setSubtext(html2text(note.content)) action.setType(Plasma.QueryMatch.ExactMatch) action.setIcon(KIcon("everpad")) action.setData(str(note.id)) context.addMatch(query, action)
def addItem(self, id_, name="", description="", diskUsage="", mounted=False): """ Adds an item to list. """ if mounted: if ctx.Pds.session == ctx.pds.Kde4: icon = KIcon("drive-harddisk", None, ["emblem-mounted"]) else: icon = QtGui.QIcon( KIconLoader.loadOverlayed('drive-harddisk', ["emblem-mounted"], 32)) else: icon = KIcon("drive-harddisk") type_ = "disk" # Build widget and widget item widget = self.makeItemWidget(id_, name, description, \ diskUsage, type_, icon, mounted) widgetItem = ItemListWidgetItem(self.listItems, widget) # Delete is unnecessary widget.hideDelete() # Add to list self.listItems.setItemWidget(widgetItem, widget)
def do_show(): notification = KNotification("Updates") # Keep a reference or the callback of the actions added # below will never work. # See: https://bugzilla.redhat.com/show_bug.cgi?id=241531 self.__last_notification = notification notification.setFlags(KNotification.CloseOnTimeout) notification.setText("<b>%s</b><br/>%s" % ( title, text, )) if buttons: notification.setActions([x[1] for x in buttons]) notification.connect(notification, SIGNAL("activated(unsigned int)"), _action_activate_cb) icon_name = "okay" status = KStatusNotifierItem.Passive if urgency == "critical": icon_name = "critical" status = KStatusNotifierItem.Active name = self.icons.get(icon_name) icon = KIcon(name) self._window.setStatus(status) notification.setPixmap(icon.pixmap(48, 48)) notification.sendEvent() self.last_alert = (title, text)
def do_show(): notification = KNotification("Updates") # Keep a reference or the callback of the actions added # below will never work. # See: https://bugzilla.redhat.com/show_bug.cgi?id=241531 self.__last_notification = notification notification.setFlags(KNotification.CloseOnTimeout) notification.setText("<b>%s</b><br/>%s" % (title, text,)) if buttons: notification.setActions([x[1] for x in buttons]) notification.connect( notification, SIGNAL("activated(unsigned int)"), _action_activate_cb) icon_name = "okay" status = KStatusNotifierItem.Passive if urgency == "critical": icon_name = "critical" status = KStatusNotifierItem.Active name = self.icons.get(icon_name) icon = KIcon(name) self._window.setStatus(status) notification.setPixmap(icon.pixmap(48, 48)) notification.sendEvent() self.last_alert = (title, text)
def __init__(self, parent=None, name=None, preferences=None): super(PreferencesDialog, self).__init__(parent, name, preferences) self.setButtons( KDialog.ButtonCode(KDialog.Ok | KDialog.Apply | KDialog.Cancel)) self.resize(QSize(550, 420)) # Setup pages self.general_page = GeneralPage(self, preferences) self.nepomuk_page = NepomukPage(self, preferences) self.general_page_item = self.addPage(self.general_page, i18n('Layout')) self.danbooru_page = DanbooruPage(self, preferences) self.danbooru_page_item = self.addPage(self.danbooru_page, i18n("Danbooru URLs")) self.nepomuk_page_item = self.addPage(self.nepomuk_page, i18n("Tagging")) self.general_page_item.setIcon(KIcon("table")) self.danbooru_page_item.setIcon( KIcon("preferences-web-browser-shortcuts")) self.nepomuk_page_item.setIcon(KIcon("nepomuk"))
def getActionIcon(self, state=None): state = self.state if state == None else state return { self.INSTALL: KIcon("list-add"), self.REMOVE: KIcon("list-remove"), self.UPGRADE: KIcon("system-software-update"), self.ALL: KIcon("preferences-other") }[state]
def __init__(self, parent, id_, title="", description="", diskUsage=None, type_=None, icon=None, state=None): QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.id = id_ self.type = type_ self.setTitle(title) self.setDescription(description) if icon: self.setIcon(icon) else: self.labelIcon.hide() self.setState(state) # Progress Bar if diskUsage: try: capacity, used, percentage = diskUsage #İf disk usage is above 85 percent progress bar gets red if percentage < 85: self.setStyleSheet(DEFAULT) else: self.setStyleSheet(FULL) self.progressBar.setValue(percentage) self.progressBar.setFormat("%.2f/%.2fGB" % (used, capacity)) except TypeError: self.progressBar.setVisible(0) else: #İf device is not mounted hide progress bar self.progressBar.setVisible(0) # Buttons self.pushEdit.setIcon(KIcon("preferences-other")) self.pushDelete.setIcon(KIcon("edit-delete")) # Signals self.connect( self.checkState, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("stateChanged(int)"), self.checkState.checkState())) self.connect(self.pushEdit, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("editClicked()"))) self.connect(self.pushDelete, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("deleteClicked()")))
def __init__(self, parent): QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.id = None self.type = None # Kernel button signal connect self.kernelButton.clicked.connect(self.slotFileDialog) self.kernelButton.setIcon(KIcon("folder")) # Ramdisk button signal connect self.ramdiskButton.clicked.connect(self.slotRamDialog) self.ramdiskButton.setIcon(KIcon("folder"))
def __init__(self, datadir, component_data=None, parent=None): LanguageSelectorBase.__init__(self, datadir) KCModule.__init__(self, component_data, parent) self.parentApp = KApplication.kApplication() self.ui = Ui_QtLanguageSelectorGUI() self.ui.setupUi(self) self.about = MakeAboutData() self.setAboutData(self.about) self.setWindowIcon(KIcon("preferences-desktop-locale")) self.imSwitch = ImSwitch() # remove dangling ImSwitch symlinks if present self.imSwitch.removeDanglingSymlinks() self.init() # connect the signals self.connect(self.ui.listViewLanguagesInst, SIGNAL("itemSelectionChanged()"), self.checkInstallableComponents) self.connect(self.ui.listViewLanguagesUninst, SIGNAL("itemSelectionChanged()"), self.onChanged) self.connect(self.ui.ktabwidget, SIGNAL("currentChanged(int)"), self.onTabChangeRevertApply) self.connect(self.ui.listBoxDefaultLanguage, SIGNAL("itemSelectionChanged()"), self.checkInputMethods) self.connect(self.ui.checkBoxTr, SIGNAL("stateChanged(int)"), self.onChanged) self.connect(self.ui.checkBoxIm, SIGNAL("stateChanged(int)"), self.onChanged) self.connect(self.ui.checkBoxSpell, SIGNAL("stateChanged(int)"), self.onChanged) self.connect(self.ui.checkBoxFonts, SIGNAL("stateChanged(int)"), self.onChanged)
def __init__(self): QObject.__init__(self) self.window = kate.mainInterfaceWindow().window() kate.configuration.root.clear() self.act = KAction(KIcon("reload"), i18n("Auto Reload"), self) self.act.setObjectName("auto reload") self.window.actionCollection().addAction(self.act.objectName(), self.act) self.window.findChild(QMenu, 'view').addAction(self.act) if not self.act.objectName() in kate.configuration: kate.configuration[self.act.objectName()] = "alt+r" self.act.setShortcut(kate.configuration[self.act.objectName()]) self.act.setCheckable(True) self.act.setChecked(False) self.act.changed.connect(self.onActionChange) self.act.toggled.connect(self.toggle) kate.mainInterfaceWindow().viewChanged.connect(self.onViewChanged)
def iconFromTheme(*names, **kwargs): size = kwargs["size"] if "size" in kwargs else 32 try: from PyKDE4.kdeui import KIcon for name in names: if KIcon.hasThemeIcon(name): return KIcon(name) except: pass if get_desktop() == "generic": try: from gtk import icon_theme_get_default iconTheme = icon_theme_get_default() for name in names: iconInfo = iconTheme.lookup_icon(name, size, 0) if iconInfo: return QIcon(iconInfo.get_filename()) except: pass for name in names: if QIcon.hasThemeIcon(name): return QIcon(QIcon.fromTheme(name)) return QIcon()
def addDeleteAction(self): action = QAction(i18n("&Delete"), self) action.setProperty("key", QVariant(DELETE)) action.setToolTip( i18n("Delete this resource from the Nepomuk database")) action.setIcon(KIcon("edit-delete")) self.addAction(action)
def add_target(self, target): logging.debug('add_target: %s' % misc.text_type(target)) new_item = QTreeWidgetItem(self.__mainWindow.ui_dest_list) new_item.setData(0,Qt.UserRole,target) # FIXME: # the new_item lines should be auto triggered onChange to the # TreeWidget when new_item is appended. new_item.setText(0,target) new_item.setIcon(0,KIcon("drive-removable-media-usb-pendrive")) item = self.__mainWindow.ui_dest_list.currentItem() if not item: item = self.__mainWindow.ui_dest_list.topLevelItem(0) if item: self.__mainWindow.ui_dest_list.setCurrentItem(item,True) # populate from device data if self.__backend is not None: dev = self.__backend.targets[target] pretty_name = "%s %s (%s)" % (dev['vendor'], dev['model'], dev['device']) new_item.setText(0,pretty_name) new_item.setText(1,dev['label']) new_item.setText(2,misc.format_size(dev['capacity'])) free = dev['free'] if free >= 0: new_item.setText(3,misc.format_size(free)) else: new_item.setText(3,'')
def __init__(self, parent, id_, title="", description="", type_=None, icon=None): QtGui.QWidget.__init__(self, parent) self.setupUi(self) self.id = id_ self.type = type_ self.setTitle(title) self.setDescription(description) if icon: self.setIcon(icon) else: self.labelIcon.hide() # Buttons self.pushEdit.setIcon(KIcon("preferences-other")) # Signals self.connect(self.pushEdit, QtCore.SIGNAL("clicked()"), lambda: self.emit(QtCore.SIGNAL("editClicked()")))
def init(self): #TODO: have a configuration interface to set keybroad shortcut #self.setHasConfigurationInterface(True) self.setAspectRatioMode(Plasma.ConstrainedSquare) self.setBackgroundHints(self.NoBackground) self.sessionBus = dbus.SessionBus() self.powerdevil = self.sessionBus.get_object( 'org.freedesktop.PowerManagement', '/modules/powerdevil') self.icon = Plasma.IconWidget(KIcon('preferences-desktop-screensaver'), '', self.applet) if KGlobalSettings.singleClick(): self.connect(self.icon, SIGNAL('clicked()'), self.turn_off_screen) else: self.connect(self.icon, SIGNAL('doubleClicked()'), self.turn_off_screen) self.connect(self, SIGNAL('active()'), self.turn_off_screen) self.layout = QGraphicsLinearLayout(self.applet) self.layout.setContentsMargins(0, 0, 0, 0) self.layout.setSpacing(0) self.layout.addItem(self.icon) self.setLayout(self.layout) self.resize(25, 25)
def match(self, context): # called by krunner to let us add actions for the user if not context.isValid(): return q = context.query() runInTerminal = True # look for our keyword 'j' or 'jo' if q.startsWith("j "): q = q[1:] elif q.startsWith("jo "): q = q[2:] runInTerminal = False else: return # strip the keyword and leading space q = q.trimmed() f = os.popen('autojump --completion %s' % q) result = f.read() lines = result.split('\n') if len(lines) == 0: return for line in lines: if len(line) > 0: dir = line[line.find('/'):] # now create an action for the user, and send it to krunner m = Plasma.QueryMatch(self.runner) m.setText(dir) m.setType(Plasma.QueryMatch.ExactMatch) m.setIcon(KIcon("dialog-information")) m.setData(runInTerminal) context.addMatch(q, m)
def addItem(self, id_, name="", description="", icon="security-medium", state=False): """ Adds an item to list. """ type_ = "" # Build widget and widget item widget = self.makeItemWidget(id_, name, description, type_, KIcon(icon), state) widgetItem = ItemListWidgetItem(self.listItems, widget) # Rules are static widget.hideDelete() # Add to list self.listItems.setItemWidget(widgetItem, widget) # Check if a filter matches item if not self.itemMatchesFilter(widgetItem): self.listItems.setItemHidden(widgetItem, True)
def __init__(self, useDevelopmentRelease=False, useProposed=False): self.useDevelopmentRelease = useDevelopmentRelease self.useProposed = useProposed metaRelease = MetaReleaseCore(useDevelopmentRelease, useProposed) metaRelease.downloaded.wait() if metaRelease.new_dist is None and __name__ == "__main__": sys.exit() elif metaRelease.new_dist is None: return self.progressDialogue = QDialog() if os.path.exists("fetch-progress.ui"): self.APPDIR = QDir.currentPath() else: self.APPDIR = "/usr/share/ubuntu-release-upgrader" uic.loadUi(self.APPDIR + "/fetch-progress.ui", self.progressDialogue) self.progressDialogue.setWindowIcon(KIcon("system-software-update")) self.progressDialogue.setWindowTitle(_("Upgrade")) self.progress = KDEAcquireProgressAdapter( self.progressDialogue.installationProgress, self.progressDialogue.installingLabel, None) DistUpgradeFetcherCore.__init__(self, metaRelease.new_dist, self.progress)
def main(): global app, aboutData import setproctitle setproctitle.setproctitle("iosshy") from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale, QSettings from PyQt4.QtGui import QApplication, QSystemTrayIcon, QImage from tunneldialog import TunnelDialog try: from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs from PyKDE4.kdeui import KApplication, KIcon aboutData = KAboutData( name, #appName name, #catalogName ki18n(name), #programName version, ki18n(description), #shortDescription KAboutData.License_BSD, #licenseKey ki18n("© 2010 Massimiliano Torromeo"), #copyrightStatement ki18n(""), #text url #homePageAddress ) aboutData.setBugAddress("http://github.com/mtorromeo/iosshy/issues") aboutData.addAuthor( ki18n("Massimiliano Torromeo"), #name ki18n("Main developer"), #task "*****@*****.**" #email ) aboutData.setProgramLogo(QImage(":icons/network-server.png")) KCmdLineArgs.init(sys.argv, aboutData) app = KApplication() app.setWindowIcon(KIcon("network-server")) if app.isSessionRestored(): sys.exit(0) except ImportError: app = QApplication(sys.argv) app.setOrganizationName("MTSoft") app.setApplicationName(name) if QSystemTrayIcon.isSystemTrayAvailable(): translator = QTranslator() qmFile = "tunneller_%s.qm" % QLocale.system().name() if os.path.isfile(qmFile): translator.load(qmFile) app.installTranslator(translator) dialog = TunnelDialog() sys.exit(app.exec_()) else: print "System tray not available. Exiting." sys.exit(1)
def pixmapFromSVG(name): from PyKDE4.plasma import Plasma from PyKDE4.kdeui import KIcon svg = Plasma.Svg() svg.setImagePath("icons/audio") if not svg.isValid(): return KIcon(name).pixmap(22, 22) svg.setContainsMultipleImages(False) return svg.pixmap(name)
def __init__(self, parent, path): "creates item and sets needed variables like type and size" QtGui.QTreeWidgetItem.__init__(self, parent, path) self.path = path self.setText(0, os.path.basename(path).decode("utf-8")) self.children = [] self.size = 0 if os.path.isdir(self.path): self.type = "dir" self.pix = KIcon("folder") elif os.path.isfile(self.path): self.type = "file" self.pix = KIcon("text-plain") self.size = os.path.getsize(self.path) self.writeSize() self.setIcon(0, self.pix) self.setChecked(True) self.addChildren()
def popup(caption, text, iconName=None, iconSize=16): ''' Show passive popup using native KDE API ''' parentWidget = kate.mainWindow() if iconName: icon = KIcon(iconName).pixmap(QSize(iconSize, iconSize)) KPassivePopup.message(caption, text, icon, parentWidget) else: KPassivePopup.message(caption, text, parentWidget)
def __init__(self, parent): QDialog.__init__(self, parent) loadUi("GDebiKDEInstallDialog.ui", self) self.setWindowTitle(_("Installing")) self.showDetailsButton.setText(__("libept", "Show Details")) #FIXME check i18n self.closeButton.setText(__("kdelibs", "&Close")) self.showDetailsButton.setIcon(KIcon("utilities-terminal")) self.closeButton.setIcon(KIcon("window-close")) self.closeButton.setEnabled(False) self.closeButton.setVisible(False) self.parent = parent self.konsole = None self.konsoleFrameLayout = QHBoxLayout(self.konsoleFrame) self.konsoleFrame.hide() self.newKonsole() kapp = KApplication.kApplication() kapp.processEvents()
def initialize(self): self.hideAllWidgets() if self.config.getOpenDesktopKey(): self.settings.opendesktop_loggedin.show() else: self.settings.opendesktop_login.show() self.settings.opendesktop_login_check.setIcon(KIcon("dialog-ok")) self.settings.opendesktop_login_user.setText("") self.settings.opendesktop_login_pass.setText("") self.checkDefault()
def setupActions(self): clearAction = KAction(KIcon("edit-clear"), i18n("Clear"), self) self.actionCollection().addAction("clear", clearAction) self.connect(clearAction, SIGNAL("triggered(bool)"), self.textArea.clear) KStandardAction.quit(app.quit, self.actionCollection()) self.setupGUI(QSize(600, 400), KXmlGuiWindow.Default, os.path.join(sys.path[0], "kactionui.rc"))
def showReleaseNotes(self): # FIXME: care about i18n! (append -$lang or something) self.dialogue = QDialog() uic.loadUi(self.APPDIR + "/dialog_release_notes.ui", self.dialogue) upgradeButton = self.dialogue.buttonBox.button(QDialogButtonBox.Ok) upgradeButton.setText(_("Upgrade")) upgradeButton.setIcon(KIcon("dialog-ok")) cancelButton = self.dialogue.buttonBox.button(QDialogButtonBox.Cancel) cancelButton.setIcon(KIcon("dialog-cancel")) self.dialogue.setWindowTitle(_("Release Notes")) self.dialogue.show() if self.new_dist.releaseNotesURI is not None: uri = self._expandUri(self.new_dist.releaseNotesURI) # download/display the release notes # FIXME: add some progress reporting here result = None try: release_notes = urlopen(uri) notes = release_notes.read().decode("UTF-8", "replace") self.dialogue.scrolled_notes.setText(notes) result = self.dialogue.exec_() except HTTPError: primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ _("Could not find the release notes") secondary = _("The server may be overloaded. ") KMessageBox.sorry(None, primary + "<br />" + secondary, "") except IOError: primary = "<span weight=\"bold\" size=\"larger\">%s</span>" % \ _("Could not download the release notes") secondary = _("Please check your internet connection.") KMessageBox.sorry(None, primary + "<br />" + secondary, "") # user clicked cancel if result == QDialog.Accepted: self.progressDialogue.show() return True if __name__ == "__main__": KApplication.kApplication().exit(1) if self.useDevelopmentRelease or self.useProposed: #FIXME why does KApplication.kApplication().exit() crash but # this doesn't? sys.exit() return False
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setupUi(self) self.parent = parent self._selectedGroups = [] self._preexceptions = [] self._postexceptions = [] self.state = StateManager(self) self.currentState = None self.completer = None self._updatesCheckedOnce = False # Search Thread self._searchThread = PThread(self, self.startSearch, self.searchFinished) self.statusUpdater = StatusUpdater() self.basket = BasketDialog(self.state, self.parent) self._postexceptions.append(lambda: self.basket.setActionEnabled(True)) self.searchButton.setIcon(KIcon("edit-find")) self.initializeUpdateTypeList() model = PackageModel(self) proxy = PackageProxy(self) proxy.setSourceModel(model) self.packageList.setModel(proxy) self.packageList.setItemDelegate(PackageDelegate(self, self.parent)) self.packageList.setColumnWidth(0, 32) self.connect(self.packageList.model(), SIGNAL("dataChanged(QModelIndex,QModelIndex)"), self.statusChanged) self.connect(self.packageList, SIGNAL("updateRequested()"), self.initialize) self.updateSettings() self.setActionButton() self.operation = OperationManager(self.state) self.progressDialog = ProgressDialog(self.state, self.parent) self._preexceptions.append(self.progressDialog._hide) self.progressDialog.registerFunction( FINISHED, lambda: self.parent.statusBar().setVisible( not self.progressDialog.isVisible())) self.progressDialog.registerFunction( OUT, lambda: self.parent.statusBar().show()) self.summaryDialog = SummaryDialog() self.connectOperationSignals() self.pdsMessageBox = PMessageBox(self.content)