Ejemplo n.º 1
0
def main():

    app_name = "danbooru_client"
    catalog = "danbooru_client"
    program_name = ki18n("Danbooru Client")
    version = "1.0.0"
    description = ki18n("A client for Danbooru sites.")
    license = KAboutData.License_GPL
    copyright = ki18n("(C) 2009 Luca Beltrame")
    text = ki18n("Danbooru Client is a program to"
                 " access Danbooru image boards.")
    home_page = u"http://www.dennogumi.org"
    bug_email = "*****@*****.**"

    about_data = KAboutData(app_name, catalog, program_name, version,
                            description, license, copyright, text, home_page,
                            bug_email)
    about_data.setProgramIconName("internet-web-browser")

    component_data = KComponentData(about_data)
    component_data.setAboutData(about_data)

    KCmdLineArgs.init(sys.argv, about_data)
    app = KApplication()
    window = mainwindow.MainWindow()
    window.show()
    app.exec_()
def main():
    about = KAboutData(
        b'synaptiks', '', ki18n('synaptiks'), str(synaptiks.__version__),
        ki18n('touchpad management and configuration application'),
        KAboutData.License_BSD,
        ki18n('Copyright (C) 2009, 2010 Sebastian Wiesner'))
    about.addAuthor(ki18n('Sebastian Wiesner'), ki18n('Maintainer'),
                    '*****@*****.**')
    about.addCredit(
        ki18n('Valentyn Pavliuchenko'),
        ki18n('Debian packaging, russian translation, '
              'bug reporting and testing'), '*****@*****.**')
    about.setHomepage('http://synaptiks.lunaryorn.de/')
    about.setOrganizationDomain('synaptiks.lunaryorn.de')

    KCmdLineArgs.init(sys.argv, about)
    app = KApplication()
    window = KMainWindow()
    touchpad = Touchpad.find_first(Display.from_qt())
    config = TouchpadConfiguration(touchpad)
    config_widget = TouchpadConfigurationWidget(config)
    config_widget.configurationChanged.connect(
        partial(print, 'config changed?'))
    window.setCentralWidget(config_widget)
    window.show()
    app.exec_()
Ejemplo n.º 3
0
def main():

    app_name = "vlc_snapper"
    catalog = "danbooru_client"
    program_name = ki18n("KDE VLC Snapper")
    version = "0.1"
    description = ki18n("A screenshot taker for video clips.")
    license = KAboutData.License_GPL
    copyright = ki18n("(C) 2011 Luca Beltrame")
    text = ki18n("")
    home_page = "http://www.dennogumi.org"
    bug_email = "*****@*****.**"

    about_data = KAboutData(app_name, catalog, program_name, version,
                            description, license, copyright, text, home_page,
                            bug_email)

    about_data.setProgramIconName("internet-web-browser")

    KCmdLineArgs.init(sys.argv, about_data)
    app = KApplication()
    dialog = capturewidget.CaptureDialog()
    dialog.show()

    app.lastWindowClosed.connect(dialog.deleteLater)
    app.exec_()
Ejemplo n.º 4
0
    def __init__(self):

        aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION,
                               DESCRIPTION, LICENSE, COPYRIGHT, TEXT, HOMEPAGE,
                               BUG_EMAIL)

        aboutData.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"),
                            "*****@*****.**", "")
        aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"),
                            "*****@*****.**", "")
        aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"),
                            "*****@*****.**", "")
        aboutData.setProgramIconName(common.ICON_FILE)
        self.aboutData = aboutData

        KCmdLineArgs.init(sys.argv, aboutData)
        options = KCmdLineOptions()
        options.add("l").add("verbose", ki18n("Enable verbose logging"))
        options.add("c").add("configure",
                             ki18n("Show the configuration window on startup"))
        KCmdLineArgs.addCmdLineOptions(options)
        args = KCmdLineArgs.parsedArgs()

        self.app = KApplication()

        try:
            # Create configuration directory
            if not os.path.exists(CONFIG_DIR):
                os.makedirs(CONFIG_DIR)
            # Create data directory (for log file)
            if not os.path.exists(DATA_DIR):
                os.makedirs(DATA_DIR)
            # Create run directory (for lock file)
            if not os.path.exists(RUN_DIR):
                os.makedirs(RUN_DIR)

            # Initialise logger
            rootLogger = logging.getLogger()
            rootLogger.setLevel(logging.DEBUG)

            if args.isSet("verbose"):
                handler = logging.StreamHandler(sys.stdout)
            else:
                handler = logging.handlers.RotatingFileHandler(
                    LOG_FILE, maxBytes=MAX_LOG_SIZE, backupCount=MAX_LOG_COUNT)
                handler.setLevel(logging.INFO)

            handler.setFormatter(logging.Formatter(LOG_FORMAT))
            rootLogger.addHandler(handler)

            if self.__verifyNotRunning():
                self.__createLockFile()

            self.initialise(args.isSet("configure"))

        except Exception as e:
            self.show_error_dialog(
                i18n("Fatal error starting AutoKey.\n") + str(e))
            logging.exception("Fatal error starting AutoKey: " + str(e))
            sys.exit(1)
Ejemplo n.º 5
0
def main():
    global app, aboutData

    import setproctitle
    setproctitle.setproctitle("iosshy")

    from PyQt4.QtCore import QCoreApplication, QTranslator, QLocale, QSettings
    from PyQt4.QtGui import QApplication, QSystemTrayIcon, QImage

    from tunneldialog import TunnelDialog

    try:
        from PyKDE4.kdecore import ki18n, KAboutData, KCmdLineArgs
        from PyKDE4.kdeui import KApplication, KIcon

        aboutData = KAboutData(
            name, #appName
            name, #catalogName
            ki18n(name), #programName
            version,
            ki18n(description), #shortDescription
            KAboutData.License_BSD, #licenseKey
            ki18n("© 2010 Massimiliano Torromeo"), #copyrightStatement
            ki18n(""), #text
            url #homePageAddress
        )
        aboutData.setBugAddress("http://github.com/mtorromeo/iosshy/issues")
        aboutData.addAuthor(
            ki18n("Massimiliano Torromeo"), #name
            ki18n("Main developer"), #task
            "*****@*****.**" #email
        )
        aboutData.setProgramLogo(QImage(":icons/network-server.png"))

        KCmdLineArgs.init(sys.argv, aboutData)

        app = KApplication()
        app.setWindowIcon(KIcon("network-server"))

        if app.isSessionRestored():
            sys.exit(0)
    except ImportError:
        app = QApplication(sys.argv)
        app.setOrganizationName("MTSoft")
        app.setApplicationName(name)


    if QSystemTrayIcon.isSystemTrayAvailable():
        translator = QTranslator()
        qmFile = "tunneller_%s.qm" % QLocale.system().name()
        if os.path.isfile(qmFile):
            translator.load(qmFile)
        app.installTranslator(translator)

        dialog = TunnelDialog()
        sys.exit(app.exec_())
    else:
        print "System tray not available. Exiting."
        sys.exit(1)
Ejemplo n.º 6
0
    def __init__(self):

        app_name = "magneto"
        catalog = ""
        prog_name = ki18n("Magneto")
        version = "1.0"
        description = ki18n("System Update Status")
        lic = KAboutData.License_GPL
        cright = ki18n("(c) 2013 Fabio Erculiani")
        text = ki18n("none")
        home_page = "www.sabayon.org"
        bug_mail = "*****@*****.**"

        self._kabout = KAboutData(app_name, catalog, prog_name, version,
                                  description, lic, cright, text, home_page,
                                  bug_mail)

        argv = [sys.argv[0]]
        KCmdLineArgs.init(argv, self._kabout)
        self._app = KApplication()

        from dbus.mainloop.qt import DBusQtMainLoop
        super(Magneto, self).__init__(main_loop_class=DBusQtMainLoop)

        self._window = KStatusNotifierItem()
        # do not show "Quit" and use quitSelected() signal
        self._window.setStandardActionsEnabled(False)

        icon_name = self.icons.get("okay")
        self._window.setIconByName(icon_name)
        self._window.setStatus(KStatusNotifierItem.Passive)

        self._window.connect(self._window,
                             SIGNAL("activateRequested(bool,QPoint)"),
                             self.applet_activated)
        self._menu = KMenu(_("Magneto Entropy Updates Applet"))
        self._window.setContextMenu(self._menu)

        self._menu_items = {}
        for item in self._menu_item_list:
            if item is None:
                self._menu.addSeparator()
                continue

            myid, _unused, mytxt, myslot_func = item
            name = self.get_menu_image(myid)
            action_icon = KIcon(name)

            w = KAction(action_icon, mytxt, self._menu)
            self._menu_items[myid] = w
            self._window.connect(w, SIGNAL("triggered()"), myslot_func)
            self._menu.addAction(w)

        self._menu.hide()
Ejemplo n.º 7
0
def main():
    appName = "KMainWindow"
    catalog = ""
    programName = ki18n("KMainWindow")
    version = "1.0"
    description = ki18n("Tutorial - Second Program")
    license = KAboutData.License_GPL
    copyright = ki18n("(c) 2007 Jim Bublitz")
    text = ki18n("none")
    homePage = "www.riverbankcomputing.com"
    bugEmail = "*****@*****.**"

    aboutData = KAboutData(appName, catalog, programName, version, description,
                           license, copyright, text, homePage, bugEmail)

    KCmdLineArgs.init(sys.argv, aboutData)

    app = KApplication()

    #------- new stuff added here ----------

    mainWindow = MainWindow()
    mainWindow.show()
    app.exec_()
Ejemplo n.º 8
0
def main():
    from argparse import ArgumentParser, RawTextHelpFormatter
    parser = ArgumentParser(description=__doc__,
            formatter_class=RawTextHelpFormatter)

    parser.add_argument('-v', '--version', action='version', version='%(prog)s ' + __version__)

    parser.add_argument('file', nargs='?', help='PDF file to open')
    parser.add_argument('-o', '--output', help='where to save the cropped PDF')
    parser.add_argument('--rotate', type=int, choices=[0,90,180,270], help='how much to rotate the cropped pdf clockwise (default: 0)')
    parser.add_argument('--whichpages', help='which pages (e.g. "1-5" or "1,3-") to include in cropped PDF (default: all)')
    parser.add_argument('--initialpage', help='which page to open initially (default: 1)')
    parser.add_argument('--autotrim', action='store_true', help='create a selection for the entire initial page minus blank margins')
    parser.add_argument('--autotrim-padding', help='how much padding to include when auto trimming (default: previous value)')
    parser.add_argument('--go', action='store_true', help='output PDF without opening the krop GUI (using the choices from --autotrim, --rotate and --whichpages); if used in a script without X server access, you can run krop using xvfb-run')
    parser.add_argument('--selections', type=str, choices=['all','evenodd','individual'], help='to which pages should selections apply')
    parser.add_argument('--no-kde', action='store_true', help='do not use KDE libraries (default: use if available)')
    parser.add_argument('--no-qt5', action='store_true', help='do not use PyQt5 instead of PyQt4 (default: use PyQt5 if available)')
    parser.add_argument('--no-PyPDF2', action='store_true', help='do not use PyPDF2 instead of pyPdf (default: use PyPDF2 if available)')

    args = parser.parse_args()

    # start the GUI
    if KDE:
        #TODO also use PyKDE5 once more easily available
        from PyKDE4.kdecore import ki18n, KCmdLineArgs, KAboutData
        from PyKDE4.kdeui import KApplication
        appName     = "krop"
        catalog     = ""
        programName = ki18n("krop")
         
        aboutData = KAboutData(appName, catalog, programName, __version__)
         
        KCmdLineArgs.init(aboutData)
        app = KApplication()
    else:
        from krop.qt import QApplication
        app = QApplication(sys.argv)
        app.setApplicationName("krop")

    app.setOrganizationName("arminstraub.com")
    app.setOrganizationDomain("arminstraub.com")

    from krop.mainwindow import MainWindow
    window=MainWindow()

    if args.file is not None:
        fileName = args.file
        try:
            fileName = fileName.decode(sys.stdin.encoding or sys.getdefaultencoding())
        except AttributeError:
            # not necessary (or possible) in python3, which uses unicode
            pass
        window.openFile(fileName)
    if args.output is not None:
        window.ui.editFile.setText(args.output)
    if args.whichpages is not None:
        window.ui.editWhichPages.setText(args.whichpages)
    if args.rotate is not None:
        window.ui.comboRotation.setCurrentIndex({0:0,90:2,180:3,270:1}[args.rotate])
    if args.selections is not None:
        if args.selections == 'all':
            window.ui.radioSelAll.setChecked(True)
        elif args.selections == 'evenodd':
            window.ui.radioSelEvenOdd.setChecked(True)
        elif args.selections == 'individual':
            window.ui.radioSelIndividual.setChecked(True)
    if args.initialpage is not None:
        window.ui.editCurrentPage.setText(args.initialpage)
        window.slotCurrentPageEdited(args.initialpage)
    if args.autotrim_padding is not None:
        window.ui.editPadding.setText(args.autotrim_padding)
    if args.autotrim:
        window.slotTrimMarginsAll()

    # shut down on ctrl+c when pressed in terminal (not gracefully, though)
    # http://stackoverflow.com/questions/4938723/
    import signal
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    if args.go:
        #  sys.stdout.write('kropping...\n')
        from krop.qt import QTimer
        QTimer.singleShot(0, window.slotKrop)
        QTimer.singleShot(0, window.close)
    else:
        window.show()

    # using exec_ because exec is a reserved keyword before python 3
    sys.exit(app.exec_())
Ejemplo n.º 9
0
            self.resize(640, 480)
            self.setCentralWidget(MainFrame(self))

    #-------------------- main ------------------------------------------------

    appName = "default"
    catalog = ""
    programName = ki18n("default")  #ki18n required here
    version = "1.0"
    description = ki18n("Default Example")  #ki18n required here
    license = KAboutData.License_GPL
    copyright = ki18n("(c) 2007 Jim Bublitz")  #ki18n required here
    text = ki18n("none")  #ki18n required here
    homePage = "www.riverbank.com"
    bugEmail = "*****@*****.**"

    aboutData = KAboutData(appName, catalog, programName, version, description,
                           license, copyright, text, homePage, bugEmail)

    # ki18n required for first two addAuthor () arguments
    aboutData.addAuthor(ki18n("Troy Melhase"), ki18n("original concept"))
    aboutData.addAuthor(ki18n("Jim Bublitz"), ki18n("pykdedocs"))

    KCmdLineArgs.init(sys.argv, aboutData)

    app = KApplication()
    mainWindow = MainWin(None, "main window")
    mainWindow.show()
    app.connect(app, SIGNAL("lastWindowClosed ()"), app.quit)
    app.exec_()
Ejemplo n.º 10
0
    def __init__(self):
        BaseFrontend.__init__(self)

        self.previous_excepthook = sys.excepthook
        sys.excepthook = self.excepthook

        self.debconf_callbacks = {}
        self.language_questions = ('oem_config', 'language_label',
                                   'language_heading_label',
                                   'timezone_heading_label',
                                   'keyboard_heading_label',
                                   'user_heading_label',
                                   'back', 'next')
        self.current_step = None
        # Set default language.
        dbfilter = language.Language(self, self.debconf_communicator())
        dbfilter.cleanup()
        dbfilter.db.shutdown()
        self.allowed_change_step = True
        self.allowed_go_forward = True
        self.mainLoopRunning = False
        self.apply_changes = False

        appName = "oem-config"
        catalog = ""
        programName = ki18n("OEM Config")
        version = "1.0"
        description = ki18n("Sets up the system")
        license = KAboutData.License_GPL
        copyright = ki18n("2006, 2007 Anirudh Ramesh. 2008 Canonical Ltd.")
        text = ki18n("none")
        homePage = "http://www.kubuntu.org"
        bugEmail = ""

        aboutData = KAboutData(appName, catalog, programName, version, description,
                               license, copyright, text, homePage, bugEmail)

        KCmdLineArgs.init(['oem-config', '-style=oxygen'], aboutData)

        self.app = KApplication()
        # We want to hide the minimise button if running in the ubiquity-only mode (no desktop)
        # To achieve this we need to set window flags to Dialog but we also need a parent widget which is showing
        # else Qt tried to be clever and puts the minimise button back
        self.parentWidget = QWidget()
        self.parentWidget.show()

        # The parent for our actual user interface window, this is needed only because Oxygen widget 
        # style refuses to draw our background on a top level widget
        self.parent2 = QWidget(self.parentWidget)
        self.parent2.setAutoFillBackground(True)
        self.parent2.setWindowState(Qt.WindowFullScreen)
        self.parent2.setWindowFlags(Qt.Dialog)
        layout = QVBoxLayout(self.parent2)
        layout.setContentsMargins(0, 0, 0, 0)

        self.userinterface = OEMConfUI(self.parent2)
        self.userinterface.setFrontend(self)
        layout.addWidget(self.userinterface)
        self.parent2.show()

        self.userinterface.next.setIcon(KIcon("go-next"))
        self.userinterface.back.setIcon(KIcon("go-previous"))

        self.translate_widgets()

        self.customize_installer()
        
        self.tzmap = TimezoneMap(self)
        map_vbox = QVBoxLayout(self.userinterface.map_frame)
        map_vbox.setMargin(0)
        map_vbox.addWidget(self.tzmap)