Пример #1
0
 def __init__(self, parent=None):
     KMainWindow.__init__(self, parent)
     self.setWindowIcon(KIcon("security-high"))
     widget = MainWidget(self)
     KGlobal.locale().insertCatalog("firewall-manager")
     self.resize(widget.size())
     self.setCentralWidget(widget)
Пример #2
0
 def __init__(self, parent=None):
     KMainWindow.__init__(self, parent)
     self.setWindowIcon(KIcon("security-high"))
     widget = MainWidget(self)
     KGlobal.locale().insertCatalog("firewall-manager")
     self.resize(widget.size())
     self.setCentralWidget(widget)
Пример #3
0
    def __init__ (self, app):
        KMainWindow.__init__(self)

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("network-manager")

        self.resize (640, 480)
        self.setCentralWidget(MainManager(self, True, app))
Пример #4
0
    def __init__ (self, app):
        KMainWindow.__init__(self)

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("network-manager")

        self.resize (640, 480)
        self.setCentralWidget(MainManager(self, True, app))
Пример #5
0
 def removeShortcut(self, name):
     """
     Deletes the given action if existing.
     """
     resolvedName = self.resolveName(name)
     action = self._collection.action(resolvedName)
     if action:
         action.deleteLater()
         KGlobal.config().group(self._manager.configGroup).deleteEntry(resolvedName)
Пример #6
0
    def __init__ (self, *args):
        KMainWindow.__init__(self)
        self.setWindowIcon(KIcon("flag-yellow"))

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("service-manager")

        self.resize (640, 480)
        self.setCentralWidget(MainManager(self))
Пример #7
0
    def __init__(self, *args):
        KMainWindow.__init__(self)
        self.setWindowIcon(KIcon("flag-yellow"))

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("service-manager")

        self.resize(640, 480)
        self.setCentralWidget(MainManager(self))
Пример #8
0
    def init(self):
        plasmascript.Applet.init(self)
        KGlobal.locale().insertCatalog("veromix");
        if "usr/share/kde4" not in os.path.realpath(__file__):
            out = commands.getstatusoutput("xdg-icon-resource install --size 128 " + unicode(self.package().path()) + "contents/icons/veromix-plasmoid-128.png veromix-plasmoid")
            if out[0] == 0:
                print "veromix icon installed"
            else:
                print "Error installing veromix icon:", out

        LADSPAPresetLoader().install_ladspa_presets_if_needed()
        if self.is_ladspa_enabled():
            # force singleton initialisation
            LADSPAPresetLoader().presets()
            LADSPAEffects().effects()

        createDbusServiceDescription(self.package().path() + "/dbus-service/VeromixServiceQt.py", True)

        KGlobal.locale().insertCatalog("veromix")

        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)
        self.theme = Plasma.Svg(self)

        self.widget = VeroMix(self)
        self.widget.init()

        defaultSize =  QVariant(QSize (0,0))
        size = self.config().readEntry("size", defaultSize).toSize()
        if self.formFactor() == Plasma.Planar:
            self.widget.setMinimumSize(275,125)
        elif (size != defaultSize) :
            self.widget.setPreferredSize(size.width(), size.height())
        else:
            self.widget.setPreferredSize(470 ,145)

        self.connect(self.widget, SIGNAL("resized()"), self.dialogResized)
        #try:
        self.setGraphicsWidget(self.widget)
        self.applet.setPassivePopup(True)
        ## FIXME: see fixPopupcion
        self.setPopupIcon(KIcon("audio-volume-high"))
        #self.setPopupIcon("audio-volume-muted")
        # dont know why but adding it a second time helps (otherwise it
        # wont popup when you add it directly to the panel)
        self.setGraphicsWidget(self.widget)
        self.connect(self.applet, SIGNAL("appletDestroyed(Plasma::Applet*)"), self.doExit)
        self.setBackgroundHints(Plasma.Applet.StandardBackground)
        self.applyConfig()
        #except AttributeError , e:
            #print e
            #updateMetadataDesktop(self)

        self.initTooltip()
        self.initShortcuts()
        QTimer.singleShot(1000, self.fixPopupIcon)
Пример #9
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        KGlobal.locale().insertCatalog(catalog)

        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default = True)

        MainWidget(self, embed=True)
Пример #10
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        KGlobal.locale().insertCatalog(about.catalog)

        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default=True)

        MainWidget(self, embed=True)
Пример #11
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("network-manager")

        # DBUS MainLoop
        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default=True)

        MainManager(self, standAlone=False)
Пример #12
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        # This is very important for translations when running as kcm_module
        KGlobal.locale().insertCatalog("network-manager")

        # DBUS MainLoop
        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default = True)

        MainManager(self, standAlone = False)
Пример #13
0
 def __init__(self, component_data, parent=None):
     KCModule.__init__(self, component_data, parent)
     KGlobal.locale().insertCatalog('synaptiks')
     # keep a reference to the generated about data to prevent it from being
     # deleted by the GC
     self._about = make_about_data(
         ki18nc('kcmodule description', 'Touchpad configuration'))
     self.setAboutData(self._about)
     self.setQuickHelp(i18nc(
         '@info:tooltip synaptiks kcmodule',
         '<title>Touchpad configuration</title>'
         '<para>This module lets you configure your touchpad.</para>'))
Пример #14
0
 def paths():
     """ build a list of paths based on config """
     # in which prefixes to look for relative paths
     prefixes = KGlobal.dirs().kfsstnd_prefixes().split(os.pathsep)
     prefixes = set(prefixes + ['/usr/', '/usr/local/'])
     # if the path is not absolute, add it to all prefixes.
     for path in conf.readEntry("paths", defaultPaths):
         if os.path.isabs(path):
             yield path
         else:
             for pref in prefixes:
                 yield os.path.join(pref, path)
             for d in KGlobal.dirs().findDirs("data", path):
                 yield d
Пример #15
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        self.remove_autostart = True

        lang = KGlobal.locale().language()
        if lang in ["de", "el", "es", "it", "uz"]:
            self.helpPageUrl = "http://chakraos.org/wiki/index.php?title=Help/" + lang
        else:
            self.helpPageUrl = "http://chakraos.org/wiki/index.php?title=Help"
        if lang in [
                "de", "es", "eu", "fr", "it", "pl", "pt-br", "sv", "ru", "uz",
                "zh-hant"
        ]:
            self.beginnersGuideUrl = "http://chakraos.org/wiki/index.php?title=Beginner's_Guide/" + lang
        else:
            self.beginnersGuideUrl = "http://chakraos.org/wiki/index.php?title=Beginner's_Guide"

        self.autofile = os.path.expanduser(
            "~/.config/autostart/kapudan.desktop")
        self.gautofile = "/usr/share/kde4/apps/kapudan/kapudan/kapudan-autostart.desktop"

        self.ui.autostart.setChecked(False)
Пример #16
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()

        if lang == "hu":
            self.helpPageUrl = "http://www.facebook.com/blackpantheros"
        else:
            self.helpPageUrl = "http://www.blackpantheros.eu"

        self.smoltUrl = "http://backend.blackpanther.hu"

        users = partition.allUsers()
        
        # ittkapcsoldki
        if not users:
            self.ui.migrationGroupBox.hide()
        #idaig

        self.ui.buttonSystemSettings_2.connect(self.ui.buttonSystemSettings_2, SIGNAL("clicked()"), self.startSmolt)
        self.ui.buttonMigration.connect(self.ui.buttonMigration, SIGNAL("clicked()"), self.startMigration)
        self.ui.buttonSystemSettings.connect(self.ui.buttonSystemSettings, SIGNAL("clicked()"), self.startSystemSettings)
        self.ui.buttonHelpPages.connect(self.ui.buttonHelpPages, SIGNAL("clicked()"), self.startHelpPages)
Пример #17
0
    def __init__(self, servicePrefix):
        # We manage our own documents.
        self.documents = []
        self.history = []       # latest shown documents

        # KApplication needs to be instantiated before any D-Bus stuff
        self.kapp = KApplication()
        
        # Here we can setup config() stuff before MainWindow and its tools 
        # are created.
        config = KGlobal.config().group("") # root group
        self.setupConfiguration(config)
        config.sync()
        
        # DBus init
        serviceName = "{0}{1}".format(servicePrefix, os.getpid())
        DBusItem.__init__(self, serviceName, '/MainApp')

        # We support only one MainWindow.
        self.mainwin = self.createMainWindow()
        self.kapp.setTopWidget(self.mainwin)

        # Get our beloved editor :-)
        self.editor = KTextEditor.EditorChooser.editor()
        self.editor.readConfig()

        # restore session etc.
        self._sessionStartedFromCommandLine = False
Пример #18
0
 def indentationWidth(self):
     """Returns the indent-width for the current document."""
     v = self.kateVariable("indent-width")
     if v and v.isdigit():
         return int(v)
     group = KGlobal.config().group("Kate Document Defaults")
     return group.readEntry("Indentation Width", 2)
Пример #19
0
    def __init__(self, parent=None):
        plasmascript.Applet.__init__(self, parent)

        self.kdehome = unicode(KGlobal.dirs().localkdedir())
        self.iconPath = '/usr/share/kde4/apps/plasma/plasmoids/kde-plasma-spacer/contents/icons/Spacer.png'
        self.icon = Plasma.IconWidget()
        self.icon.setIcon(self.iconPath)
Пример #20
0
	def __init__(self, parent = None):
		plasmascript.Applet.__init__(self, parent)

		self.kdehome = unicode(KGlobal.dirs().localkdedir())
		self.iconPath = '/usr/share/kde4/apps/plasma/plasmoids/kde-plasma-spacer/contents/icons/Spacer.png'
		self.icon = Plasma.IconWidget()
		self.icon.setIcon(self.iconPath)
Пример #21
0
 def tabWidth(self):
     """Returns the width of the tab character in this document."""
     v = self.kateVariable("tab-width")
     if v and v.isdigit():
         return int(v)
     group = KGlobal.config().group("Kate Document Defaults")
     return group.readEntry("Tab Width", 8)
Пример #22
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()

        if lang == "tr":
            self.helpPageUrl = "http://www.pardus.org.tr/destek"
        else:
            self.helpPageUrl = "http://www.pardus.org.tr/eng/support"

        self.smoltUrl = "http://smolt.pardus.org.tr:8090"

        users = partition.allUsers()
        if not users:
            self.ui.migrationGroupBox.hide()

        self.ui.buttonSystemSettings_2.connect(self.ui.buttonSystemSettings_2,
                                               SIGNAL("clicked()"),
                                               self.startSmolt)
        self.ui.buttonMigration.connect(self.ui.buttonMigration,
                                        SIGNAL("clicked()"),
                                        self.startMigration)
        self.ui.buttonSystemSettings.connect(self.ui.buttonSystemSettings,
                                             SIGNAL("clicked()"),
                                             self.startSystemSettings)
        self.ui.buttonHelpPages.connect(self.ui.buttonHelpPages,
                                        SIGNAL("clicked()"),
                                        self.startHelpPages)
Пример #23
0
 def __init__(self, parent):
     QtCore.QObject.__init__(self)
     self.applet = parent
     self.kdehome = unicode(KGlobal.dirs().localkdedir())
     if not os.path.exists(self.kdehome+u"share/apps/%s/%s.notifyrc" % (self.applet.metadata.pluginName(), self.applet.metadata.pluginName())):
         # Install notifyrc file if required
         self.install_notifications()
Пример #24
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        # Get screen resolution
        rect =  QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst= KStandardDirs().findAllResources("wallpaper", "*metadata.desktop", KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name[%s]'%self.catLang, '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry', 'X-KDE-PluginInfo-Author', '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            thumbFolder = os.listdir(os.path.join(os.path.split(str(desktopFiles))[0], "contents"))

            """
            Appearantly the thumbnail names doesn't have a standart.
            So we get the file list from the contents folder and
            choose the file which has a name that starts with "scre".

            File names I've seen so far;
            screenshot.jpg, screnshot.jpg, screenshot.png, screnshot.png
            """

            wallpaperThumb = ""

            for thumb in thumbFolder:
                if thumb.startswith('scre'):
                    wallpaperThumb = os.path.join(os.path.split(str(desktopFiles))[0], "contents/" + thumb)

            wallpaperFile = os.path.split(str(desktopFiles))[0]

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle), unicode(wallpaperDesc), wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(120,170))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper, SIGNAL("itemSelectionChanged()"), self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp, SIGNAL("clicked()"), self.selectWallpaper)
Пример #25
0
def saveOnRunWarning():
    """ Copy old setting to the new save on run notification setting (1.1.2)"""
    c = KGlobal.config()
    group = c.group("preferences")
    if group.readEntry("save on run", False):
        group = c.group("Notification Messages")
        group.writeEntry("save_on_run", False)
        c.sync()
Пример #26
0
 def initializeProcess(self, p):
     rumor = config("commands").readEntry("rumor", "rumor")
     cmd = [rumor] + self.panel.getRumorArguments()
     if self.panel.keyboardEmu:
         # Run Rumor in a pty when keyboard input is used.
         runpty = KGlobal.dirs().findResource("appdata", "lib/runpty.py")
         cmd[0:0] = [sys.executable, runpty]
     p.setProgram(cmd)
     p.setOutputChannelMode(KProcess.OnlyStdoutChannel)
Пример #27
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        KGlobal.locale().insertCatalog(catalog)
        self.setButtons(KCModule.Apply)

        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default=True)

        mw = MainWidget(self, embed=True)
        self.load = mw.load
        self.save = mw.save
        self.defaults = mw.defaults

        def configChanged():
            self.changed.emit(True)

        mw.configChanged.connect(configChanged)
Пример #28
0
    def __init__(self, component_data, parent):
        KCModule.__init__(self, component_data, parent)

        KGlobal.locale().insertCatalog(catalog)
        self.setButtons(KCModule.Apply)

        if not dbus.get_default_main_loop():
            from dbus.mainloop.qt import DBusQtMainLoop
            DBusQtMainLoop(set_as_default=True)

        mw = MainWidget(self, embed=True)
        self.load = mw.load
        self.save = mw.save
        self.defaults = mw.defaults

        def configChanged():
            self.changed.emit(True)

        mw.configChanged.connect(configChanged)
Пример #29
0
 def download(self, url):
     """Download the package from given KUrl."""
     self.progress.setRange(0, 100)
     self.status.setText(i18n("Downloading %1...", url.fileName()))
     dest = KGlobal.dirs().saveLocation('tmp')
     self.job = KIO.copy(url, KUrl(dest),
         KIO.JobFlags(KIO.Overwrite | KIO.Resume | KIO.HideProgressInfo))
     QObject.connect(self.job, SIGNAL("percent(KJob*, unsigned long)"), self.slotPercent)
     QObject.connect(self.job, SIGNAL("result(KJob*)"), self.slotResult, Qt.QueuedConnection)
     self.job.start()
Пример #30
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()
        if lang == "tr":
            self.helpPageUrl = "http://www.pardus-anka.org"
        else:
            self.helpPageUrl = "http://worldforum.pardus-linux.nl"
Пример #31
0
	def user_or_sys(self, path_):
		kdehome = unicode(KGlobal.dirs().localkdedir())
		var1 = kdehome + 'share/apps/plasma/plasmoids/kde-plasma-mail-checker/contents/' + path_
		var2 = '/usr/share/kde4/apps/plasma/plasmoids/kde-plasma-mail-checker/contents/' + path_
		if os.path.exists(var2) :
			return var2
		elif os.path.exists(var1) :
			return var1
		else :
			return os.path.expanduser('~/kde-plasma-mail-checker/contents/' + path_)
Пример #32
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()
        if lang == "tr":
            self.helpPageUrl = "http://www.pardus.org.tr/destek"
        else:
            self.helpPageUrl = "http://www.pardus.org.tr/eng/support"

        self.smoltUrl = "http://smolt.pardus.org.tr:8090"
Пример #33
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()
        if lang == "tr":
            self.helpPageUrl = "http://www.pisilinux.org"
        else:
            self.helpPageUrl = "http://www.pisilinuxworld.org"

        self.smoltUrl = "http://smolt.pisilinux.org:8090"
Пример #34
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()
        if lang == "tr":
            self.helpPageUrl = "http://www.pardus.org.tr/destek"
        else:
            self.helpPageUrl = "http://www.pardus.org.tr/eng/support"

        self.smoltUrl = "http://smolt.pardus.org.tr:8090"
Пример #35
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_goodbyeWidget()
        self.ui.setupUi(self)

        lang = KGlobal.locale().language()
        if lang == "tr":
            self.helpPageUrl = "http://www.pisilinux.org"
        else:
            self.helpPageUrl = "http://www.pisilinuxworld.org"

        self.smoltUrl = "http://smolt.pisilinux.org:8090"
Пример #36
0
    def ensure_notifyrc(self):
        appdir = '{base}/share/apps/{app}/'.format(
            base=KGlobal.dirs().localkdedir(), app=self.appname)
        rcpath = os.path.join(appdir,
                              '{app}.notifyrc'.format(app=self.appname))

        if os.path.exists(rcpath):
            return

        if not os.path.exists(appdir):
            os.mkdir(appdir)

        copyfile(self.source, rcpath)
Пример #37
0
    def init(self):
        base.BaseApplet.init(self, needsversion="4.5")
        if self.hasFailedToLaunch():
            return

        KGlobal.locale().insertCatalog(self.metadata.pluginName())
        lang = KGlobal.locale().language()
        print "Language:", lang
        print "Translated?", KGlobal.locale().isApplicationTranslatedInto(lang)

        self._widget = None
        self.dialog = None
        self.has_tooltip = False
        self.setHasConfigurationInterface(True)
        self.setAspectRatioMode(Plasma.IgnoreAspectRatio)

        self.notifier = Notifier(self)
        self.nwmon = NetworkMonitor()
        if self.nwmon.connected():
            self.setBusy(False)
        else:
            self.notifier.notify("waiting-for-network", i18n("Waiting for network connection."))

        self.nwmon.status_changed.connect(self.netstate_changed)

        # Main widget
        print("CurrencyConverterApplet: Creating main widget.")
        self._widget = CurrencyConverter(self)
        self._widget.init()
        self.setGraphicsWidget(self._widget)
        self.setPopupIcon(self.metadata.pluginName())

        self.setGraphicsWidget(self._widget)

        #self.setup_tooltip()

        self.configChanged()
        self._widget.updated.connect(self.setup_tooltip)
Пример #38
0
 def run(self, sender=None):
     """
     Last minute setup and enter the KDE event loop.
     At the very last, instantiates one empty doc if nothing loaded yet.
     """
     if self.kapp.isSessionRestored():
         self.mainwin.restore(1, False)
     elif (len(self.documents) == 0
           and not self._sessionStartedFromCommandLine):
         # restore named session?
         action = config("preferences").readEntry("default session", "")
         if action == "lastused":
             self.mainwin.sessionManager().restoreLastSession()
         elif action == "custom":
             session = config("preferences").readEntry("custom session", "")
             if session in self.mainwin.sessionManager().names():
                 self.mainwin.sessionManager().switch(session)
     if len(self.documents) == 0:
         self.createDocument().setActive()
     sys.excepthook = self.handleException
     self.mainwin.show()
     self.kapp.exec_()
     KGlobal.config().sync()
Пример #39
0
    def __init__(self):
        QMainWindow.__init__(self)

        self.miniMode = False
        self.initialised = False

        # set i18n language for libeclectus
        setTranslationLanguage(unicode(KGlobal.locale().language()))

        # start rendering thread
        self.renderThread = renderthread.SQLRenderThread(g_app)
        self.connect(g_app, SIGNAL("aboutToQuit()"),
            self.renderThread.quit)
        self.renderThread.start()

        self.connect(self.renderThread, SIGNAL("queueEmpty"), self.queueEmpty)
        self.connect(self.renderThread, SIGNAL("jobEnqueued"), self.jobEnqueued)
        self.connect(self.renderThread, SIGNAL("jobErrorneous"),
            lambda jobId, classObject, method, args, param, e, stacktrace: \
                showDebug(stacktrace.decode('utf8')))

        self.updateDialog = update.UpdateDialog(self, self.renderThread)
        #self.updateDialog = None # set to None to disable updating
        if self.updateDialog:
            self.connect(self.updateDialog, SIGNAL("databaseChanged()"),
                lambda: self.emit(SIGNAL("databaseChanged()")))

        # set up UI
        self.setupUi()
        self.setupActions()

        # finally build gui
        xmlFile = os.path.join(os.getcwd(), 'eclectusqt', 'eclectusui.rc')
        if os.path.exists(xmlFile):
            self.setupGUI(KXmlGuiWindow.StandardWindowOption(
                KXmlGuiWindow.Default ^ KXmlGuiWindow.StatusBar), xmlFile)
        else:
            self.setupGUI(KXmlGuiWindow.StandardWindowOption(
                KXmlGuiWindow.Default ^ KXmlGuiWindow.StatusBar))

        self.restoreWindowState()

        self.setCentralWidget(self.splitterFrame)
        self.splitterFrame.setVisible(True)

        self.initialised = True

        if (GeneralConfig.readEntry("Show installer on startup", 'True')
            == 'True') and self.updateAction:
            self.updateAction.trigger()
Пример #40
0
Файл: kde.py Проект: KDE/kajongg
def cacheDir():
    """the cache directory for this user"""
    if Internal.isServer:
        result = os.path.join(appdataDir(), 'cache')
    else:
        result = os.path.dirname(
            unicode(KGlobal.dirs().locateLocal("cache", "")))
        result = os.path.join(result, 'kajongg')
    if not os.path.exists(result):
        try:
            os.makedirs(result)
        except OSError:
            pass
    return result
Пример #41
0
	def __init__(self, parent = None):
		plasmascript.Applet.__init__(self, parent)

		self.kdehome = unicode(KGlobal.dirs().localkdedir())

		if os.path.exists('/usr/share/kde4/apps/plasma/plasmoids/kde-plasma-cpufrequtility/contents/icons/performance.png') :
			self.iconPath = '/usr/share/kde4/apps/plasma/plasmoids/kde-plasma-cpufrequtility/contents/icons/performance.png'
		elif os.path.exists(self.kdehome + '/share/apps/plasma/plasmoids/kde-plasma-cpufrequtility/contents/icons/performance.png') :
			self.iconPath = self.kdehome + '/share/apps/plasma/plasmoids/kde-plasma-cpufrequtility/contents/icons/performance.png'
			#print 'installing', self.iconPath
		else :
			self.iconPath = os.getcwd() + '/plasmaCpuFreqUtility/contents/icons/performance.png'

		self.Settings = QSettings('kde-plasma-cpufrequtility', 'kde-plasma-cpufrequtility')
Пример #42
0
def findDicts():
    """ Find installed hyphen dictionary files """
    conf = config("hyphenation")
    def paths():
        """ build a list of paths based on config """
        # in which prefixes to look for relative paths
        prefixes = KGlobal.dirs().kfsstnd_prefixes().split(os.pathsep)
        prefixes = set(prefixes + ['/usr/', '/usr/local/'])
        # if the path is not absolute, add it to all prefixes.
        for path in conf.readEntry("paths", defaultPaths):
            if os.path.isabs(path):
                yield path
            else:
                for pref in prefixes:
                    yield os.path.join(pref, path)
                for d in KGlobal.dirs().findDirs("data", path):
                    yield d

    # now find the hyph_xx_XX.dic files
    dicfiles = (f
        for p in paths() if os.path.isdir(p)
            for f in glob(os.path.join(p, 'hyph_*.dic')) if os.access(f, os.R_OK))

    # default to the users current locale if not used before
    defaultlang = None

    global hyphdicts
    # empty it, because we might be called again when the user changes
    # the settings.
    hyphdicts = {}
    for dic in dicfiles:
        lang = os.path.basename(dic)[5:-4]
        # find a human readable name belonging to the language code
        for i in lang, lang.split('_')[0]:
            name = KGlobal.locale().languageCodeToName(i)
            if name:
                name = '{0} ({1})'.format(name, lang)
                hyphdicts[name] = dic
                # set current locale as default
                if lang == language:
                    defaultlang = name
                break
        else:
            hyphdicts[lang] = dic

    # if not used before, write the current locale (if existing) as default
    if defaultlang and conf.readEntry("lastused", "") not in hyphdicts:
        conf.writeEntry("lastused", defaultlang)
        conf.sync()
Пример #43
0
def getColorSchemesAndPath():
    from Core import Settings

    colorSchemes, colorSchemePaths = [], []
    colorSchemes.append("Default")
    colorSchemePaths.append("")
    if isActivePyKDE4:
        from PyKDE4.kdecore import KStandardDirs, KGlobal

        schemeFiles = KGlobal.dirs().findAllResources(
            "data", "color-schemes/*.colors", KStandardDirs.NoDuplicates)
        for scheme in schemeFiles:
            sets = Settings.getSettings(scheme)
            colorSchemes.append(
                trStr(sets.value("Name", fu.getBaseName(scheme))))
            colorSchemePaths.append(scheme)
    return colorSchemes, colorSchemePaths
Пример #44
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_styleWidget()
        self.ui.setupUi(self)

        self.styleDetails = {}
        self.catLang = KGlobal.locale().language()

        config = KConfig("kwinrc")
        group = config.group("Desktops")
        defaultDesktopNumber = int(group.readEntry('Number'))

        self.ui.spinBoxDesktopNumbers.setValue(defaultDesktopNumber)
        lst2 = glob.glob1("/usr/kde/4/share/apps/kaptan/gui/styles", "*.style")

        for desktopFiles in lst2:
            parser = DesktopParser()
            parser.read("/usr/kde/4/share/apps/kaptan/gui/styles/" +
                        str(desktopFiles))
            try:
                styleName = unicode(
                    parser.get_locale('Style', 'name[%s]' % self.catLang, ''))
            except:
                styleName = unicode(parser.get_locale('Style', 'name', ''))
            try:
                styleDesc = unicode(
                    parser.get_locale('Style',
                                      'description[%s]' % self.catLang, ''))
            except:
                styleDesc = unicode(
                    parser.get_locale('Style', 'description', ''))
            try:
                # TODO find a fallback values for these & handle exceptions seperately.
                #styleApplet = parser.get_locale('Style', 'applets', '')
                panelPosition = parser.get_locale('Style', 'panelPosition', '')
                #styleColorScheme = parser.get_locale('Style', 'colorScheme', '')
                widgetStyle = unicode(
                    parser.get_locale('Style', 'widgetStyle', ''))
                desktopTheme = unicode(
                    parser.get_locale('Style', 'desktopTheme', ''))
                colorScheme = unicode(
                    parser.get_locale('Style', 'colorScheme', ''))
                iconTheme = unicode(parser.get_locale('Style', 'iconTheme',
                                                      ''))
                windowDecoration = unicode(
                    parser.get_locale('Style', 'windowDecoration', ''))
                styleThumb = unicode(
                    os.path.join("/usr/kde/4/share/apps/kaptan/gui/styles/",
                                 parser.get_locale('Style', 'thumbnail', '')))

                colorDict = {}
                colorDir = "/usr/kde/4/share/apps/color-schemes/"
                self.Config = ConfigParser()
                self.Config.optionxform = str
                color = colorDir + colorScheme + ".colors"
                if not os.path.exists(color):
                    color = colorDir + "Oxygen.colors"

                self.Config.read(color)
                #colorConfig= KConfig("kdeglobals")
                for i in self.Config.sections():
                    #colorGroup = colorConfig.group(str(i))
                    colorDict[i] = {}
                    for key, value in self.ConfigSectionMap(i).items():
                        colorDict[i][key] = value
                        #colorGroup.writeEntry(str(key), str(value))

                self.styleDetails[styleName] = {
                    "description": styleDesc,
                    "widgetStyle": widgetStyle,
                    "colorScheme": colorDict,
                    "desktopTheme": desktopTheme,
                    "iconTheme": iconTheme,
                    "windowDecoration": windowDecoration,
                    "panelPosition": panelPosition
                }

                item = QtGui.QListWidgetItem(self.ui.listStyles)
                widget = StyleItemWidget(unicode(styleName),
                                         unicode(styleDesc), styleThumb,
                                         self.ui.listStyles)
                self.ui.listStyles.setItemWidget(item, widget)
                item.setSizeHint(QSize(120, 170))
                item.setStatusTip(styleName)
            except:
                print "Warning! Invalid syntax in ", desktopFiles

        self.ui.listStyles.connect(self.ui.listStyles,
                                   SIGNAL("itemSelectionChanged()"),
                                   self.setStyle)
        self.ui.comboBoxDesktopType.connect(
            self.ui.comboBoxDesktopType, SIGNAL("activated(const QString &)"),
            self.setDesktopType)
        self.ui.spinBoxDesktopNumbers.connect(
            self.ui.spinBoxDesktopNumbers,
            SIGNAL("valueChanged(const QString &)"), self.addDesktop)
Пример #45
0
                return _applyFormatter(dt, _mediumFormatter)
            return _applyFormatter(dt, _shortFormatter)
        return _applyFormatter(dt, _hourFormatter)

    def rawDateFunc(dt):
        return _applyFormatter(datetime.datetime.combine(dt, datetime.time(0, 0, 0, 0)), _dateFormatter)
elif desktop.get_desktop() == 'KDE4':
    try:
        # Import gtk first because when it's imported indirectly it generates a RuntimeWarning.
        import gtk
        from PyKDE4.kdecore import KGlobal, KLocale
        from PyQt4.QtCore import QTime, QDate
    except ImportError:
        pass
    else:
        _localeCopy = KLocale(KGlobal.locale())
        if '%p' in KGlobal.locale().timeFormat():
            _localeCopy.setTimeFormat('%I %p')
        else:
            _localeCopy.setTimeFormat('%H')
        def rawTimeFunc(dt, minutes=True, seconds=False):
            qtdt = QTime(dt.hour, dt.minute, dt.second)
            if minutes:
                return unicode(KGlobal.locale().formatTime(qtdt, seconds))
            return unicode(_localeCopy.formatTime(qtdt))

        def rawDateFunc(dt):
            qtdt = QDate(dt.year, dt.month, dt.day)
            return unicode(KGlobal.locale().formatDate(qtdt, 0))

Пример #46
0
 def rawTimeFunc(dt, minutes=True, seconds=False):
     qtdt = QTime(dt.hour, dt.minute, dt.second)
     if minutes:
         return unicode(KGlobal.locale().formatTime(qtdt, seconds))
     return unicode(_localeCopy.formatTime(qtdt))
Пример #47
0
 def rawDateFunc(dt):
     qtdt = QDate(dt.year, dt.month, dt.day)
     return unicode(KGlobal.locale().formatDate(qtdt, 0))
Пример #48
0
# Configuration widgets
from widgets.configs import *

# KDE4 Notifier
from widgets.notify import Notifier

# Solid
from PyKDE4.solid import Solid

# Network Interface for operations
# It creates a dbus-mainlook or registers 
# itself to the current dbus mainloop if exists
from backend.pardusBackend import NetworkIface

KGlobal.locale().insertCatalog("nm-applet")

WIRED           = "network-wired"
WIRELESS        = "network-wireless"

CONNECTED       = {"title"  :i18n("Connected"),
                   "emblem" :"dialog-ok-apply",
                   "solid"  :Solid.Networking.Connected}
DISCONNECTED    = {"title"  :i18n("Disconnected"),
                   "emblem" :"edit-delete",
                   "solid"  :Solid.Networking.Unconnected}
CONNECTING      = {"title"  :i18n("Connecting"),
                   "emblem" :"chronometer",
                   "solid"  :Solid.Networking.Connecting}

ICONPATH        = "%s/contents/code/icons/%s.png"
Пример #49
0
 def getLanguage(self):
     lang = KGlobal.locale().language()
     return lang
Пример #50
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        isWide = lambda x: float(x[0]) / float(x[1]) >= 1.6
        isSquare = lambda x: float(x[0]) / float(x[1]) < 1.6

        # Get screen resolution
        rect = QtGui.QDesktopWidget().screenGeometry()

        # Get metadata.desktop files from shared wallpaper directory
        lst = KStandardDirs().findAllResources("wallpaper",
                                               "*metadata.desktop",
                                               KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry',
                                                   'Name[%s]' % self.catLang,
                                                   '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry',
                                                  'X-KDE-PluginInfo-Author',
                                                  '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            l = os.listdir(
                os.path.join(
                    os.path.split(str(desktopFiles))[0], "contents/images"))

            wallpaperFile = os.path.split(str(desktopFiles))[0]
            wallpaperThumb = os.path.join(
                os.path.split(str(desktopFiles))[0], "contents/screenshot.png")

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(unicode(wallpaperTitle),
                                         unicode(wallpaperDesc),
                                         wallpaperThumb, self.ui.listWallpaper)
            item.setSizeHint(QSize(38, 110))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.connect(self.ui.listWallpaper,
                                      SIGNAL("itemSelectionChanged()"),
                                      self.setWallpaper)
        self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"),
                                 self.disableWidgets)
        self.ui.buttonChooseWp.connect(self.ui.buttonChooseWp,
                                       SIGNAL("clicked()"),
                                       self.selectWallpaper)
Пример #51
0
    def __init__(self, *args):
        QtGui.QWidget.__init__(self, None)
        self.ui = Ui_wallpaperWidget()
        self.ui.setupUi(self)
        # Get system locale
        self.catLang = KGlobal.locale().language()

        # Get screen resolution
        # rect = QtGui.QDesktopWidget().screenGeometry() FIXME: where could
        # this be needed?

        # Get metadata.desktop files from shared wallpaper directory
        lst = KStandardDirs().findAllResources("wallpaper",
                                               "*metadata.desktop",
                                               KStandardDirs.Recursive)

        for desktopFiles in lst:
            parser = DesktopParser()
            parser.read(str(desktopFiles))

            try:
                wallpaperTitle = parser.get_locale('Desktop Entry',
                                                   'Name[%s]' % self.catLang,
                                                   '')
            except:
                wallpaperTitle = parser.get_locale('Desktop Entry', 'Name', '')

            try:
                wallpaperDesc = parser.get_locale('Desktop Entry',
                                                  'X-KDE-PluginInfo-Author',
                                                  '')
            except:
                wallpaperDesc = "Unknown"

            # Get all files in the wallpaper's directory
            try:
                thumbFolder = os.listdir(
                    os.path.join(
                        os.path.split(str(desktopFiles))[0], "contents"))
            except OSError:
                thumbFolder = os.listdir(
                    os.path.join(
                        os.path.split(str(desktopFiles))[0], "content"))
            """
            Appearantly the thumbnail names doesn't have a standard.
            So we get the file list from the contents folder and
            choose the file which has a name that starts with "scre".

            File names I've seen so far;
            screenshot.jpg, screnshot.jpg, screenshot.png, screnshot.png
            """

            wallpaperThumb = ""

            for thumb in thumbFolder:
                if thumb.startswith('scre'):
                    wallpaperThumb = os.path.join(
                        os.path.split(str(desktopFiles))[0],
                        "contents/" + thumb)

            wallpaperFile = os.path.split(str(desktopFiles))[0]

            # Insert wallpapers to listWidget.
            item = QtGui.QListWidgetItem(self.ui.listWallpaper)
            # Each wallpaper item is a widget. Look at widgets.py for more information.
            widget = WallpaperItemWidget(
                unicode(wallpaperTitle, "utf8", "replace"),
                unicode(wallpaperDesc, "utf8", "replace"), wallpaperThumb,
                self.ui.listWallpaper)
            item.setSizeHint(QSize(120, 170))
            self.ui.listWallpaper.setItemWidget(item, widget)
            # Add a hidden value to each item for detecting selected wallpaper's path.
            item.setStatusTip(wallpaperFile)

        self.ui.listWallpaper.itemSelectionChanged.connect(self.setWallpaper)
        self.ui.checkBox.stateChanged.connect(self.disableWidgets)
        self.ui.buttonChooseWp.clicked.connect(self.selectWallpaper)