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)
Example #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)
Example #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))
Example #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))
    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))
Example #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))
Example #7
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)
Example #8
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)
Example #9
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)
Example #10
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>'))
Example #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)
Example #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)
Example #13
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)
Example #14
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)
Example #15
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)
Example #16
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)
Example #17
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)
Example #18
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)
Example #19
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"
Example #20
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"
Example #21
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"
Example #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.pisilinux.org"
        else:
            self.helpPageUrl = "http://www.pisilinuxworld.org"

        self.smoltUrl = "http://smolt.pisilinux.org:8090"
Example #23
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"
    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)
Example #25
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()
Example #26
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()
 def job_received(self, job, data):
   if len(data) > 0:
     amount = self.def_amount
     # NOTE: Check if self.amount.text() is localized and convert it if neccesary.
     # Isn't there a better way of doing this?
     if KGlobal.locale().decimalSymbol() == ",":
       # remove any "."s and replace "," with "."
       # there ought to bet a prettier way to do this
       if amount.contains(","):
         amount = amount.replace(".", "").replace(",", ".")
     print "%f * %f = %f" % (float(amount), float(data), float(data)*float(amount))
     print float(data)*float(amount)
     self.conversion_result.setText(str(float(data)*float(amount)))
     self.from_amount_label.setText(KCurrencyCode(self.def_from).defaultSymbol())
     self.to_amount_label.setText(KCurrencyCode(self.def_to).defaultSymbol())
     #self.from_amount_label.setText(QString.fromUtf8(CURRENCY[str(self.currency_from.text())[0:3]].get_symbol()))
     #self.to_amount_label.setText(QString.fromUtf8(CURRENCY[str(self.currency_to.text())[0:3]].get_symbol()))
     print "Last updated:", KGlobal.locale().formatDateTime(KDateTime.currentLocalDateTime())
     self.last_updated = KGlobal.locale().formatDateTime(KDateTime.currentLocalDateTime())
     #self.last_updated = str(datetime.now().ctime())
     self.credits_label.nativeWidget().setToolTip(str(i18n("Last updated: %s")) % self.last_updated)
     self.applet.setBusy(False)
     print "Data recieved:", data
     self.updated.emit()
Example #28
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)
Example #29
0
 def _showProgress(self, dct):
     step = dct['step']
     if step in ('install', 'remove'):
         self._progressBar.setMaximum(100)
         self._progressBar.setValue(dct['percent'])
         if step == 'install':
             self._progressBar.setFormat(i18n('Installing... %p%'))
         else:
             self._progressBar.setFormat(i18n('Removing... %p%'))
     elif step == 'acquire':
         fetched = dct['fetched_bytes']
         total = dct['total_bytes']
         self._progressBar.setMaximum(total)
         self._progressBar.setValue(fetched)
         locale = KGlobal.locale()
         self._progressBar.setFormat(i18n('Downloading... %1 / %2',
                                          locale.formatByteSize(fetched),
                                          locale.formatByteSize(total)
                                          ))
Example #30
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)
Example #31
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)
Example #32
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"
Example #33
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))
 def rawDateFunc(dt):
     qtdt = QDate(dt.year, dt.month, dt.day)
     return unicode(KGlobal.locale().formatDate(qtdt, 0))
Example #35
0
def getKDELocale():
    return str(KGlobal.locale().language())
        if minutes:
            if seconds:
                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:
        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))

 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 init(self):
        print ("CurrencyConverter: init")

        self.swapping = False
        self.grid_layout = None
        self.timer = None
        self.last_updated = ""

        self.def_from = self.applet.cfg.readEntry("default_from", QString("USD")).toString()
        print "System default country:", KGlobal.locale().country()
        print "System default currency code:", KGlobal.locale().currencyCode()
        self.def_to = self.applet.cfg.readEntry("default_to", KGlobal.locale().currencyCode()).toString()
        #self.def_to = self.applet.cfg.readEntry("default_to", QString("EUR")).toString()
        self.def_amount = self.applet.cfg.readEntry("default_amount", 1.0).toString()
        self.update_interval = self.applet.cfg.readEntry("update_interval", QVariant(60)).toInt()[0] # why does this return a tuple?

        print "Update interval:", self.update_interval

        #self.theme = Plasma.Svg(self)
        #self.theme.setImagePath("widgets/background")
        #self.setBackgroundHints(Plasma.Applet.DefaultBackground)

        # init arrows svg
        #self.arrows_svg = Plasma.Svg(self);
        #self.arrows_svg.setImagePath("widgets/configuration-icons");
        #self.arrows_svg.setContainsMultipleImages(True);
        #self.arrows_svg.resize(KIconLoader.SizeSmall, KIconLoader.SizeSmall);

        #self.collapse_button = Plasma.ToolButton()
        #self.collapse_button.setZValue(3)
        #self.collapse_button.nativeWidget().setMaximumSize(QSize(24, 24))
        #if self.collapsed:
            #self.collapse_button.nativeWidget().setIcon(KIcon(QIcon(self.arrows_svg.pixmap("collapse"))))
            ##self.collapse_button.nativeWidget().setIcon(KIcon("arrow-down"))
        #else:
            #self.collapse_button.nativeWidget().setIcon(KIcon(QIcon(self.arrows_svg.pixmap("restore"))))
            ##self.collapse_button.nativeWidget().setIcon(KIcon("arrow-up"))
        #self.collapse_button.nativeWidget().setToolTip(i18n("Show/Hide controls"))
        #self.collapse_button.clicked.connect(self.collapse_or_expand)

        invert = "%scontents/icons/invert.png" % self.applet.package().path()
        self.invert_button = Plasma.ToolButton()
        self.invert_button.setZValue(3)
        self.invert_button.nativeWidget().setMaximumSize(QSize(24, 24))
        self.invert_button.nativeWidget().setIcon(KIcon(invert))
        self.invert_button.nativeWidget().setToolTip(i18n("Swap currencies"))
        self.invert_button.clicked.connect(self.invert_currencies)

        self.title_label = Plasma.Label()
        self.title_label.nativeWidget().setWordWrap(False)
        #self.title_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.title_label.setText(i18n("Currency Converter"))
        self.title_label.setAlignment(Qt.AlignCenter)
        f = self.title_label.nativeWidget().font()
        f.setBold(True)
        self.title_label.nativeWidget().setFont(f)

        self.from_label = Plasma.Label()
        self.from_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.from_label.nativeWidget().setAlignment(Qt.AlignRight)
        self.from_label.setText(i18n("From:"))

        self.currency_from = Plasma.ComboBox()
        self.currency_from.setZValue(2)
        self.currency_from.setFocusPolicy(Qt.NoFocus)

        self.to_label = Plasma.Label()
        self.to_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.to_label.nativeWidget().setAlignment(Qt.AlignRight)
        self.to_label.setText(i18n("To:"))

        self.currency_to = Plasma.ComboBox()
        self.currency_to.setZValue(1)
        self.currency_to.setFocusPolicy(Qt.NoFocus)

        self.amount_label = Plasma.Label()
        self.amount_label.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Minimum)
        self.amount_label.nativeWidget().setAlignment(Qt.AlignTop) # NOTE: This is a hack because otherwise it flows down when you resize :-/
        self.amount_label.nativeWidget().setAlignment(Qt.AlignRight)
        self.amount_label.setText(i18n("Amount:"))

        self.amount = Plasma.LineEdit()
        self.amount.setClearButtonShown(True)
        self.amount_validator = QDoubleValidator(self.amount.nativeWidget())
        #if KGlobal.locale().decimalSymbol() == ",":
        #    self.amount_validator.setAcceptLocalizedNumbers(True)
        self.amount.nativeWidget().setValidator(self.amount_validator)
        print "Default amount:", self.def_amount
        self.amount.setText(self.def_amount)
        self.amount.setFocus()

        self.amount.editingFinished.connect(self.amount_editing_finished)

        self.from_amount_label = Plasma.Label()
        self.from_amount_label.setMinimumWidth(30)

        self.equal_label = Plasma.Label()
        self.equal_label.setText("=")

        # shows the currency symbol or abbreviation
        self.to_amount_label = Plasma.Label()
        self.to_amount_label.setMinimumWidth(30)

        self.conversion_result = Plasma.LineEdit()
        self.conversion_result.nativeWidget().setAlignment(Qt.AlignRight)
        self.conversion_result.nativeWidget().setReadOnly(True)

        self.credits_label = Plasma.Label()
        self.credits_label.setAlignment(Qt.AlignRight)
        self.credits_label.nativeWidget().setOpenExternalLinks(True)
        logo = "%scontents/images/yahoo-attribution.png" % self.applet.package().path()
        self.credits_label.setText(i18n("Data from <a href=\"http://finance.yahoo.com/currency-converter\"><img src=\"%s\"</a>" % logo))
        f = self.credits_label.nativeWidget().font()
        f.setPointSize(self.font_size()-2)
        self.credits_label.nativeWidget().setFont(f)
        QObject.connect(self.credits_label.nativeWidget(), SIGNAL("linkActivated(const QString&)"), self.open_link)
        QObject.connect(self.credits_label, SIGNAL("linkActivated(const QString&)"), self.open_link)
        self.credits_label.linkActivated.connect(self.open_link)

        # Limit the number of currencies shown at a time if docked in bottom panel.
        #if ((self.applet.formFactor() == Plasma.Horizontal) or (self.applet.formFactor() == Plasma.Vertical)):
        if ((self.applet.formFactor() == Plasma.Horizontal) and (self.applet.location() == Plasma.BottomEdge)):
          self.currency_from.nativeWidget().setMaxVisibleItems(6)
          self.currency_to.nativeWidget().setMaxVisibleItems(4)

        m_locale = KGlobal.locale()
        #cc_list = l.currency().allCurrencyCodesList(KCurrencyCode.ActiveCurrency|KCurrencyCode.SuspendedCurrency|KCurrencyCode.ObsoleteCurrency)
        cc_list = m_locale.currency().allCurrencyCodesList(KCurrencyCode.ActiveCurrency)
        cc_namelist = []
        #print "CC's:", len(l.currency().allCurrencyCodesList())
        #print "# KDE Currency Codes:", len(cc_list)
        for cc in cc_list:
          cc_namelist.append(i18nc( "@item currency name and currency code", "%1 (%2)",
                                    m_locale.currency().currencyCodeToName( cc ), cc ) )

        #cc_namelist.sort()
        for cur in sorted(set(cc_namelist)):
          #print u"Currency:", unicode(cur)
          self.currency_from.nativeWidget().addItem( cur, QVariant( cur.mid( cur.length()-4, 3 ) ) )
          self.currency_to.nativeWidget().addItem( cur, QVariant( cur.mid( cur.length()-4, 3 ) ) )

        self.currency_from.nativeWidget().setCurrentIndex( self.currency_from.nativeWidget().findData( QVariant( self.def_from ) ) )
        self.currency_to.nativeWidget().setCurrentIndex( self.currency_to.nativeWidget().findData( QVariant( self.def_to ) ) )

        self.currency_from.textChanged.connect(self.currency_changed)
        self.currency_to.textChanged.connect(self.currency_changed)

        self.layout_widgets()
        if self.applet.nwmon.connected():
          self.applet.setBusy(False)
          self.start_timer()
Example #39
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))

Example #40
0
 def rawDateFunc(dt):
     qtdt = QDate(dt.year, dt.month, dt.day)
     return unicode(KGlobal.locale().formatDate(qtdt, 0))
Example #41
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)
Example #42
0
 def getLanguage(self):
     lang = KGlobal.locale().language()
     return lang
Example #43
0
 def getLanguage(self):
     lang = KGlobal.locale().language()
     return lang
Example #44
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)
Example #45
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(38,110))
                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)
Example #46
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)
    def __init__(self, *args):
        QtGui.QWidget.__init__(self,None)
        self.ui = Ui_recommendWidget()
        self.ui.setupUi(self)
        self.check_update = checkUpdateThread(self)
        self.check_update.start()

        self.catLang = KGlobal.locale().language()

#        self.ui.listRecommendApp.connect(self.ui.listRecommendApp, SIGNAL("itemSelectionChanged()"), self.setInstall)
        self.connect(self, SIGNAL("disable"), self.disableInstallButton)
#        it = threading.Thread(target=self.init, args=(self))
#        it.start()
        
#    def init(self):
        plugnum = "0"
	config = ConfigParser()

	userConf = os.path.expanduser("~/.config/profiler/recommend.cfg")
	if not os.path.exists(userConf):
	    print "System list found.."
	    config.read('recommend.cfg')
	else:
	    config.read(userConf)
	    print "User list found.."

	applist = config.sections()

	grouplist = []

	for app in applist:
	    try:
		group = config.get(app, "group")
		if group not in grouplist:
		    grouplist.append(group)
	    except:
		print "Not found for", app
        print "Csoport lista kész:",
        applist.sort()
        grouplist.sort()
        print grouplist

        self.install_time_thread = InstallTimeThread(self, applist)

        for group in grouplist:
          self.new_tab(group, group)

	for app in applist:
            group = config.get(app, "group")
	    try:
		Title = app
		Desc = config.get(app, "desc")
		Summary = config.get(app, "summary")
#		Thumb = app+".jpg"
		Size = config.get(app, "size")
		InstallTime = 1
		#config.get(app, "installtime")
		favor = eval(config.get(app, "favorite"))
	    except:
		print "Not found for", app
		continue

            thumbFolder = os.listdir(os.path.join("./module_gui/pics", "screenshots"))
            Thumb = os.path.join("./module_gui/pics/screenshots/" + app + ".png")
            
	    if group == "Plugins":
		Thumb = "./module_gui/pics/plugins.png"
		print "Plugins detected..."


	    if not os.path.exists(Thumb):
		print "Empty App Thumbnail detected..."
		Thumb = "./module_gui/pics/blackPanther_shield200.png"

            Tooltip = "<img src="+Thumb+"/><br /><br /><b>\nName:</b> "+app+"<br /><br /><b>\nDescription:</b> "+Desc+"<br />"

            item = QtGui.QListWidgetItem(self.ui.__dict__[group+"_listRecommendApp"])
            self.__dict__["RIW_"+group+"_"+app] = RecommendItemWidget(unicode(Title, "utf8", "replace"), unicode(Summary, "utf8", "replace"), Size, unicode(Tooltip, "utf8", "replace"), Thumb, self.ui.__dict__[group+"_listRecommendApp"])
            item.setSizeHint(QSize(38,110))
            self.ui.__dict__[group+"_listRecommendApp"].setItemWidget(item, self.__dict__["RIW_"+group+"_"+app])
            self.connect(self.__dict__["RIW_"+group+"_"+app].ui.installButton, SIGNAL("clicked()"), lambda x=app: self.setInstall(x))

            if favor:
              item = QtGui.QListWidgetItem(self.ui.listRecommendApp)
              self.__dict__["RIW_default_"+app] = RecommendItemWidget(unicode(Title, "utf8", "replace"), unicode(Summary, "utf8", "replace"), Size, unicode(Tooltip, "utf8", "replace"), Thumb, self.ui.listRecommendApp)
              item.setSizeHint(QSize(38,110))
              self.ui.listRecommendApp.setItemWidget(item, self.__dict__["RIW_default_"+app])
              self.connect(self.__dict__["RIW_default_"+app].ui.installButton, SIGNAL("clicked()"), lambda x=app: self.setInstall(x))

    	    self.ui.checkBox.connect(self.ui.checkBox, SIGNAL("stateChanged(int)"), self.disableWidgets)

        #self.ui.pushInstallButton.connect(self.ui.pushInstallButton, SIGNAL("clicked()"), self.goInstall)
        self.ui.pushUpdateButton.connect(self.ui.pushUpdateButton, SIGNAL("clicked()"), self.goUpdate)
        
        self.install_time_thread.start()
Example #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"