Example #1
0
 def __init__(self, *args):
     KApplication.__init__(self)
     cfg = BaseConfig()
     self.cfg = cfg
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
     dsn = {}
     self.cfg.setGroup('database')
     dsn['user'] = self.cfg.readEntry('dbuser')
     dsn['dbname'] = self.cfg.readEntry('dbname')
     dsn['passwd'] = self.cfg.readEntry('dbpass')
     self.cfg.setGroup('pgpool')
     self.pgpool = None
     usepgpool = self.cfg.readEntry('usepgpool')
     if usepgpool != 'false':
         print 'using pgpool'
         self.pgpool = PgPool(self.cfg, self.tmpdir, self.datadir)
         if not os.path.isfile(self.pgpool.pidfile):
             self.pgpool.run()
         else:
             self.pgpool = None
         dsn['host'] = 'localhost'
         dsn['port'] = self.cfg.readEntry('port')
     else:
         self.cfg.setGroup('database')
         dsn['host'] = self.cfg.readEntry('dbhost')
         dsn['port'] = self.cfg.readEntry('dbport')
     self.db = BaseDatabase(dsn, 'Konsultant', self)
     self.db.app = self
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
def main():
    aboutData = KAboutData(
        PACKAGE, PROGRAMNAME, VERSION,
        I18N_NOOP("LilyKDE servicemenu helper"),
        KAboutData.License_GPL,
        "Copyright (c) 2008, " + AUTHOR,
        "", HOMEPAGE)
    KCmdLineArgs.init (sys.argv, aboutData)
    KCmdLineArgs.addCmdLineOptions([
        ("+files", I18N_NOOP("LilyPond files to convert"))
        ])
    app = KApplication()
    log = LogWidget()
    app.setMainWidget(log)
    log.setMinimumHeight(240)
    log.setMinimumWidth(400)
    log.setCaption(PROGRAMNAME)
    log.show()

    # get the files to convert
    pa = KCmdLineArgs.parsedArgs()
    files = map(pa.arg, range(pa.count()))

    # start the first job. Itself takes care of running the rest.
    Job(files, log)
    app.exec_loop()
    def __init__(self):
        KApplication.__init__(self)
        # in case something needs done before quitting
        self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
        self.dcop = ToolBoxDCOPInterface()
        self._setup_standard_directories()
        #self._generate_data_directories()
        dbfile = os.path.join(self.datadir, 'main.db')
        #self.conn = Connection(dbname=dbfile, autocommit=True,
        #                       encoding='ascii')
        #self.guests = Guests(self.conn)
        #self.db = EntityManager(self.conn)
        from sqlalchemy import create_engine
        from sqlalchemy.orm import sessionmaker
        self.engine = create_engine('sqlite:///%s' % dbfile)
        if not self.engine.table_names():
            from newschema import metadata
            metadata.create_all(self.engine)
        self.DbSession = sessionmaker(bind=self.engine,
                                      autoflush=True, transactional=False)
        self.session = self.DbSession()
        self.db = EntityManager(self.session)
        
        self.urlhandler = MainUrlHandler(self)
        self.filehandler = BaseFileHandler(self)
        
        # setup the timer to handle background jobs
        self.timer = QTimer()
        # every five seconds
        self.timer.changeInterval(1000)
        self.connect(self.timer, SIGNAL('timeout()'), self._timer_done)

        self.main_window = None
Example #4
0
 def __init__(self, argv, opts):
     KLocale.setMainCatalogue("kdelibs")
     if not '--caption' in argv:
         argv += ['--caption', 'PyQLogger']
         sysargv = argv[:]
         from pyqlogger import VERSION
         aboutData = KAboutData("pyqlogger", "PyQLogger",
                                VERSION, "Blogger GUI",
                                KAboutData.License_GPL,
                                "(C) 2004, Eli Yukelzon", "",
                                "http://pyqlogger.berlios.de",
                                "")
         aboutData.addAuthor("Eli Yukelzon a.k.a Reflog", "",
                             "*****@*****.**")
         aboutData.addAuthor("Xander Soldaat a.k.a Mightor", "",
                             "*****@*****.**")
         try:
             options = [("s",
                         "Status bar (default = disabled)"),
                        ("statusbar",
                         "Status bar (default = disabled)")]
             KCmdLineArgs.init(argv, aboutData)
             KCmdLineArgs.addCmdLineOptions(options)
         except TypeError:
             KCmdLineArgs.init(sysargv, sysargv[0], '', '')
         if opts:
             KCmdLineArgs.addCmdLineOptions(opts)
         KApplication.__init__(self)
Example #5
0
 def __init__(self):
     KApplication.__init__(self)
     self.set_config()
     self.conn = None
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     # I probably don't need the socket dir
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
Example #6
0
 def __init__(self, *args):
     KApplication.__init__(self)
     self.cfg = PaellaConfig()
     self.conn = PaellaConnection(self.cfg)
     self.db = BaseDatabase(self.conn, 'paelladb', None)
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
     dsn = {}
Example #7
0
 def __init__(self):
     KApplication.__init__(self)
     # in case something needs done before quitting
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
     self._setup_standard_directories()
     #self._generate_data_directories()
     dbfile = os.path.join(self.datadir, 'guests.db')
     self.conn = Connection(dbname=dbfile, autocommit=True,
                            encoding='ascii')
     self.guests = Guests(self.conn)
Example #8
0
 def __init__(self, *args):
     KApplication.__init__(self)
     self.cfg = PaellaConfig()
     self.conn = PaellaConnection(self.cfg)
     self.db = BaseDatabase(self.conn, 'paelladb', None)
     dirs = KStandardDirs()
     self.tmpdir = str(dirs.findResourceDir('tmp', '/'))
     self.datadir = str(dirs.findResourceDir('data', '/'))
     self.socketdir = str(dirs.findResourceDir('socket', '/'))
     dsn = {}
Example #9
0
 def __init__(self):
     KApplication.__init__(self)
     # in case something needs done before quitting
     self.connect(self, SIGNAL('aboutToQuit()'), self.quit)
     # place dcop object here
     self.dcop = DosboxHandler()
     self._setup_standard_directories()
     self._generate_data_directories()
     self.mainconfigfilename = os.path.join(self.datadir, 'dosbox-pykde.conf')
     if os.path.isfile(self.mainconfigfilename):
         self.generate_default_config()
         self.generate_main_objects()
Example #10
0
 def saveFileList(self):
     """Update the list of monitored files in the configuration file."""
     files = []
     for mon in self.monitors:
         files.append(mon.getFileName())
     cfg = KApplication.kApplication().config()
     cfg.setGroup("Monitor")
     cfg.writeEntry("files", files)
 def __init__(self, parent, name='BaseGameDataDialog'):
     KDialogBase.__init__(self, parent, name)
     # setup app pointer
     self.app = KApplication.kApplication()
     self.myconfig = self.app.myconfig
     # we need a frame for the layout widget
     # the layout widget won't work with a window as parent
     self.frame = BaseGameDataFrame(self)
     # set frame as main widget
     self.setMainWidget(self.frame)
Example #12
0
def main():

    """Main program."""

    description = str(i18n("Simple log file viewer"))
    version = "0.3"
    about = KAboutData("lovi", "lovi", version, description,
        KAboutData.License_GPL, "Copyright (C) 2005-2006 by Akos Polster")
    about.addAuthor("Akos Polster", "", "*****@*****.**")
    KCmdLineArgs.init(sys.argv, about)
    KCmdLineArgs.addCmdLineOptions([("+files", "Files to monitor")])
    app = KApplication()
    mainWindow = MainWin(None, "lovi#")
    app.setMainWidget(mainWindow)
    
    # Get list of monitored files from the command line or from the cfg file
    args = KCmdLineArgs.parsedArgs()
    if args.count() > 0:
        for i in range(0, args.count()):
            mainWindow.monitor(args.arg(i))
    else:
        cfg = app.config()
        cfg.setGroup("Monitor")
        files = cfg.readListEntry("files")
        for f in files:
            mainWindow.monitor(str(f))
        
    mainWindow.show()
    app.exec_loop()
Example #13
0
def run_widget(myclass, use_kde=None):
    """ run a qt app using myclass as the main widget.
    This funtion calls sys.exit().
    """
    global HASKDE
    #pk.options.parse_args()
    #if has_kde() and use_kde is None:
    #    use_kde = pk.options.get('use_kde')
    HASKDE = use_kde
    if use_kde:
        from kdecore import KAboutData, KCmdLineArgs, KApplication
        about = KAboutData('A pk app', 'run_widget', '0.1')
        KCmdLineArgs.init(sys.argv, about)
        a = KApplication()
        w = myclass()
        w.show()
        a.exec_()
    else:
        from PyQt4.QtGui import QApplication
        a = QApplication(sys.argv)
        w = myclass()
        w.show()
        sys.exit(a.exec_())
Example #14
0
def runAction(url):
    """
    Runs an URL with KRun. If url starts with "email=" or "emailpreview=",
    it is converted to a mailto: link with the url attached, and opened in
    the default KDE mailer.
    If url starts with "print=", the file is directly printed with lpr.
    If url starts with "embed=", a subroutine in pdftk is called to embed
    LilyPond documents in the output PDF.
    """
    # hack: prevent QTextView recognizing mailto: urls cos it can't handle
    # query string
    url = unicode(url)        # url could be a QString
    m = re.match("([a-z]+)=(.*)", url)
    if not m:
        return krun(url)
    command, url = m.groups()
    if command == 'print':
        path = unicode(KURL(url).path())
        cmd = splitcommandline(config("commands").get("lpr", "lpr"))
        cmd.append(path)
        p = Popen(cmd, stderr=PIPE)
        if p.wait() != 0:
            error(_("Printing failed: %s") % p.stderr.read())
        else:
            info(_("The document has been sent to the printer."))
    elif command in ('email', 'emailpreview'):
        if command == "email" or warncontinue(_(
            "This PDF has been created with point-and-click urls (preview "
            "mode), which increases the file size dramatically. It's better "
            "to email documents without point-and-click urls (publish mode), "
            "because they are much smaller. Continue anyway?")):
            KApplication.kApplication().invokeMailer(
                KURL(u"mailto:?attach=%s" % url), "", True)
    elif command == 'embed':
        ly = unicode(KURL(url).path())
        from lilykde import pdftk
        pdftk.attach_files(ly)
Example #15
0
    def __init__(self):
        QObject.__init__(self)
        self.sysTray = KMySystemTray()
        self.sysTray.setPixmap(self.sysTray.loadIcon("ksmarttray"))
        self.sysTray.show()

        self.process = KProcIO()

        self.state = KSmartTray.State.Waiting
        self.lastKnownStatus = ""

        self.blinkFlag = False
        self.updateFailed = False

        self.checkTimer = QTimer()
        self.blinkTimer = QTimer()

        QObject.connect(self.checkTimer, SIGNAL("timeout()"),
                        self.checkUpgrades)
        QObject.connect(self.process, SIGNAL("processExited(KProcess *)"),
                        self.processDone)

        QObject.connect(self, PYSIGNAL("foundNewUpgrades()"),
                        self.startBlinking)
        QObject.connect(self, PYSIGNAL("foundNoUpgrades()"), self.stopBlinking)
        QObject.connect(self.sysTray, PYSIGNAL("mouseEntered()"),
                        self.stopBlinking)
        QObject.connect(self.blinkTimer, SIGNAL("timeout()"), self.toggleBlink)

        QObject.connect(self.sysTray.checkAction, SIGNAL("activated()"),
                        self.manualCheckUpgrades)
        QObject.connect(self.sysTray.startSmartAction, SIGNAL("activated()"),
                        self.startSmart)
        QObject.connect(self.sysTray.stopAction, SIGNAL("activated()"),
                        self.stopChecking)
        QObject.connect(self.sysTray, SIGNAL("quitSelected()"),
                        KApplication.kApplication(), SLOT("quit()"))

        QObject.connect(self.sysTray, PYSIGNAL("activated()"),
                        self.runUpgrades)

        self.checkTimer.start(5 * 60 * 1000)

        self.checkUpgrades()
Example #16
0
def openFile(pdf):
    """ Open the specified PDF document """

    global _file

    c = KApplication.dcopClient()
    kpdf = DCOPApp(c.appId(), c).kpdf

    # When LilyPond writes a PDF, it first deletes the old one.
    # So the new PDF gets a different inode number, which causes
    # KPDF to sometimes loose the 'watch' on the file.
    # So we call KPDF to open the file, and remember the page number
    # displayed ourselves, because KPDF also seems to forget the scroll
    # position due to LilyPond deleting the old PDF first.
    # It would be best that either KPDF is fixed to just look for a
    # named file, even if it has a different inode number, or that
    # LilyPond is fixed to not delete the old PDF first, but just
    # truncate it and write the new data into it.

    # Update June 17, 2008: LilyPond >= 2.11.49 does not delete the PDF
    # anymore on unix platforms!

    # Document already shown?
    if _file == pdf:
        # Yes this is the same PDF, see if we need to force KPDF to
        # reload the document. If not, we trust that KPDF automatically
        # updates its view.
        from lilykde.version import version
        if (
            # User can force reload of PDF with config option
            config('preferences')['force reload pdf'] == '1'
            # LilyPond >= 2.11.49 does not delete the PDF anymore on unix
            or version < (2, 11, 49) or os.name not in ('posix', 'mac')
            # read KPDF's 'watch file' option (default is true)
            or kconfig('kpdfpartrc', True, False).group('General')['WatchFile']
                in ('false', '0', 'off', 'no')):
            # Reopen same document, remembering page number
            page = kpdf.currentPage()[1]
            kpdf.openDocument(KURL(pdf))
            QTimer.singleShot(100, lambda: kpdf.goToPage(page))
    else:
        # This is another PDF, just open it.
        kpdf.openDocument(KURL(pdf))
        _file = pdf
    def setDocument(self):
        doc = open("examples/helloworld/Hello.html").read()

        app = KApplication.kApplication()
        # here we try to make a blank page first
        # as in the KTextBrowser, but this doesn't do the trick
        if True:
            view = self.view()
            view.layout()
            self.begin()
            self.write('')
            self.end()
            app.processEvents()
        app.processEvents()
        self.begin()
        self.setAutoloadImages(True)
        self.write(doc)
        self.end()

        self.connect(self, SIGNAL("completed()"),self.complete)
    def __init__(self):
        QObject.__init__(self)
        self.sysTray = KMySystemTray()
        self.sysTray.setPixmap(self.sysTray.loadIcon("ksmarttray"))
        self.sysTray.show()
    
        self.process = KProcIO()
    
        self.state = KSmartTray.State.Waiting
        self.lastKnownStatus = ""
    
        self.blinkFlag = False
        self.updateFailed = False
    
        self.checkTimer = QTimer()
        self.blinkTimer = QTimer()

        QObject.connect(self.checkTimer, SIGNAL("timeout()"), self.checkUpgrades)
        QObject.connect(self.process, SIGNAL("processExited(KProcess *)"),
                self.processDone)
    
        QObject.connect(self, PYSIGNAL("foundNewUpgrades()"), self.startBlinking)
        QObject.connect(self, PYSIGNAL("foundNoUpgrades()"), self.stopBlinking)
        QObject.connect(self.sysTray, PYSIGNAL("mouseEntered()"), self.stopBlinking)
        QObject.connect(self.blinkTimer, SIGNAL("timeout()"), self.toggleBlink)
    
        QObject.connect(self.sysTray.checkAction, SIGNAL("activated()"),
                self.manualCheckUpgrades)
        QObject.connect(self.sysTray.startSmartAction, SIGNAL("activated()"),
                self.startSmart)
        QObject.connect(self.sysTray.stopAction, SIGNAL("activated()"),
                self.stopChecking)
        QObject.connect(self.sysTray, SIGNAL("quitSelected()"),
                KApplication.kApplication(), SLOT("quit()"))
    
        QObject.connect(self.sysTray, PYSIGNAL("activated()"), self.runUpgrades)
    
        self.checkTimer.start(5*60*1000)
    
        self.checkUpgrades()
Example #19
0
 def quit(self):
     # house cleaning chores go here
     KApplication.quit(self)
Example #20
0
 def error(message, **a):
     KMessageBox.error(KApplication.kApplication().mainWidget(), message)
 def __init__(self, parent, name='BaseGameDataFrame'):
     QFrame.__init__(self, parent, name)
     # there will be more than two rows, but we'll start with two
     numrows = 2
     # there should onlty be two columns
     numcols = 2
     margin = 0
     space = 1
     # add a grid layout to the frame
     self.grid = QGridLayout(self, numrows, numcols,
                             margin, space, 'BaseGameDataLayout')
     # make a couple of lists to point to the weblink entries
     # order is important in these lists
     self.weblink_site_entries = []
     self.weblink_url_entries = []
     # I may use dict[site] = (site_entry, url_entry)
     # I haven't decided yet.  It could always be formed by zipping the 2 lists above.
     self.weblink_dict = {}
     # setup app pointer
     self.app = KApplication.kApplication()
     self.myconfig = self.app.myconfig
     # setup dialog pointers
     self.select_launch_command_dlg = None
     # Setup widgets
     # setup name widgets
     self.name_lbl = QLabel('<b>Name</b>', self)
     self.name_entry = KLineEdit('', self)
     # add name widgets to grid
     self.grid.addWidget(self.name_lbl, 0, 0)
     self.grid.addWidget(self.name_entry, 1, 0)
     # setup fullname widgets
     self.fullname_lbl = QLabel('<b>Full name</b>', self)
     self.fullname_entry = KLineEdit('', self)
     # add fullname widgets
     self.grid.addWidget(self.fullname_lbl, 2, 0)
     self.grid.addWidget(self.fullname_entry, 3, 0)
     # setup description widgets
     self.desc_lbl = QLabel('<b>Description</b>', self)
     self.desc_entry = KTextEdit(self, 'description_entry')
     # set plain text format for description entry
     # we do this in case there are html tags in the entry
     self.desc_entry.setTextFormat(self.PlainText)
     # add description widgets
     self.grid.addWidget(self.desc_lbl, 4, 0)
     #self.addWidget(self.desc_entry, 5, 0)
     # add the description as a multirow entity
     # default from 5 to 15
     # this allows for weblinks to be added
     # (about 5)
     # without the dialog looking ugly
     # going to 15 won't force there to be that many rows
     # until more enough widgets are added
     self.grid.addMultiCellWidget(self.desc_entry, 5, 15, 0, 0)
     # setup launch command widgets
     self.launch_lbl = QLabel('<b>Launch command</b>', self)
     self.launch_entry = KLineEdit('', self)
     self.launch_dlg_button = KPushButton('...', self, 'launch_dlg_button')
     self.launch_dlg_button.connect(self.launch_dlg_button, SIGNAL('clicked()'),
                                    self.select_launch_command)
     # add launch command widgets
     self.grid.addWidget(self.launch_lbl, 0, 1)
     self.grid.addWidget(self.launch_entry, 1, 1)
     self.grid.addWidget(self.launch_dlg_button, 1, 2)
     # setup dosboxpath widgets
     self.dosboxpath_lbl = QLabel('<b>dosbox path</b>', self)
     self.dosboxpath_entry = KLineEdit('', self)
     # add dosboxpath widgets
     self.grid.addWidget(self.dosboxpath_lbl, 2, 1)
     self.grid.addWidget(self.dosboxpath_entry, 3, 1)
     # setup main weblink widgets
     self.weblinks_lbl = QLabel('<b>weblinks</b>', self)
     self.weblinks_btn = KPushButton('+', self, 'add_weblink_button')
     self.weblinks_btn.connect(self.weblinks_btn, SIGNAL('clicked()'),
                               self.add_weblink_entries)
     # add main weblink widgets
     self.grid.addWidget(self.weblinks_lbl, 4, 1)
     self.grid.addWidget(self.weblinks_btn, 4, 2)
Example #22
0
 def sorry(message, **a):
     KMessageBox.sorry(KApplication.kApplication().mainWidget(), message)
Example #23
0
 def quit(self):
     if self.pgpool is not None:
         if os.path.isfile(self.pgpool.pidfile):
             self.pgpool.stop()
     KApplication.quit(self)
Example #24
0
            ch.registerDone(handleState_dhcp)
            ch.registerError(self.comarError)
            ch.registerAuthError(self.comarError)
            ch.registerDBusError(self.busError)
            ch.call()

            ch = self.callMethod("info",
                                 "tr.org.pardus.comar.system.service.set",
                                 "System.Service")
            ch.registerDone(handleState_iptables)
            ch.call()

        else:
            self.groupBox1.setEnabled(True)
            self.buttonGroup2.setEnabled(True)


if __name__ == "__main__":
    appname = ""
    description = ""
    version = ""

    KCmdLineArgs.init(sys.argv, appname, description, version)
    a = KApplication()

    QObject.connect(a, SIGNAL("lastWindowClosed()"), a, SLOT("quit()"))
    w = connShare()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()
Example #25
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import sys

from kdecore import KApplication, KAboutData, KCmdLineArgs, KGlobal, KIcon
from qt import QObject, SIGNAL, SLOT

from pakito.gui.mainwindow import MainWindow

def I18N_NOOP(x):
    return x

name = "Pakito"
version = "0.3"
mail = "*****@*****.**"
description = I18N_NOOP("A tool for accelerating package making process")

if __name__ == "__main__":    
    about = KAboutData(name.lower(), name, version, description, KAboutData.License_GPL_V2, "(C) Gökçen Eraslan 2007", None, None, mail)
    about.addAuthor("Gökçen Eraslan", None, mail)
    KCmdLineArgs.init(sys.argv, about)
    app = KApplication()
    programLogo = KGlobal.iconLoader().loadIcon("pisikga", KIcon.Desktop)
    about.setProgramLogo(programLogo.convertToImage())
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    pac = MainWindow(None, name)
    app.setMainWidget(pac)
    pac.show()
    app.exec_loop()
Example #26
0
def get_application_pointer():
    return KApplication.kApplication()
Example #27
0
#!/usr/bin/python
"""KDE support for dpaste"""
import sys, time
import dcop
import dcopext
from kdecore import KApplication, KCmdLineArgs, KAboutData
from qt import QString, QCString

import StringIO
import dpaster

description = "KDE interface to http://dpaste.com/"
version     = "0.1"
aboutData   = KAboutData ("testdcopext", "testdcopext",\
    version, description, KAboutData.License_GPL,\
    "(C) 2007 Peter Fein")

aboutData.addAuthor ("Peter Fein", "wrote it", "*****@*****.**")

KCmdLineArgs.init (sys.argv, aboutData)

app  = KApplication ()
dcop = app.dcopClient ()

d = dcopext.DCOPApp ("klipper", dcop)
res, content = d.klipper.getClipboardContents()
sio=StringIO.StringIO(content)
url=dpaster.paste(sio)
res=d.klipper.setClipboardContents(url)
Example #28
0
 def __init__(self):
     KApplication.__init__(self)
     self.conn = PaellaConnection()
     self.umlcfg = UmlConfig()
     self.update_config()
        self.tabTorrent.setCurrentPage(-1)

        KPyBTTorrentBaseLayout.addWidget(self.tabTorrent,0,0)

        self.languageChange()

        self.resize(QSize(431,270).expandedTo(self.minimumSizeHint()))
        self.clearWState(Qt.WState_Polished)


    def languageChange(self):
        self.setCaption(self.__tr("Form1"))


    def __tr(self,s,c = None):
        return qApp.translate("KPyBTTorrentBase",s,c)

if __name__ == "__main__":
    appname     = ""
    description = ""
    version     = ""

    KCmdLineArgs.init (sys.argv, appname, description, version)
    a = KApplication ()

    QObject.connect(a,SIGNAL("lastWindowClosed()"),a,SLOT("quit()"))
    w = KPyBTTorrentBase()
    a.setMainWidget(w)
    w.show()
    a.exec_loop()
Example #30
0
    @param  fileName    File to monitor
    """

    def monitor(self, fileName):
        try:
            tailer = Tail(fileName)
        except:
            KMessageBox.error(
                self,
                str(i18n("Cannot open file for monitoring:\n%s")) % fileName,
                i18n("Error - lovi"))
            return
        self.tab.addTab(Monitor(tailer), os.path.basename(fileName))


"""
Main program.
"""
description = str(i18n("Simple log file viewer"))
version = "0.1"
about = KAboutData("", "", \
    version, description, KAboutData.License_GPL, \
    "(C) 2005 Akos Polster")
about.addAuthor("Akos Polster", "", "*****@*****.**")
KCmdLineArgs.init(sys.argv, about)
# KCmdLineArgs.addCmdLineOptions([("+files", "File to open")])
app = KApplication()
mainWindow = MainWin(None, "lovi#")
mainWindow.show()
app.exec_loop()
Example #31
0
File: tab.py Project: pipacs/etc
    """
    Monitor a file.
    
    @param  fileName    File to monitor
    """
    def monitor(self, fileName):
        try:
            tailer = Tail(fileName)
        except:
            KMessageBox.error(self, 
                str(i18n("Cannot open file for monitoring:\n%s")) % fileName,
                i18n("Error - lovi"))
            return
        self.tab.addTab(Monitor(tailer), os.path.basename(fileName))

"""
Main program.
"""
description = str(i18n("Simple log file viewer"))
version = "0.1"
about = KAboutData("", "", \
    version, description, KAboutData.License_GPL, \
    "(C) 2005 Akos Polster")
about.addAuthor("Akos Polster", "", "*****@*****.**")
KCmdLineArgs.init(sys.argv, about)
# KCmdLineArgs.addCmdLineOptions([("+files", "File to open")])
app = KApplication()
mainWindow = MainWin(None, "lovi#")
mainWindow.show()
app.exec_loop()
Example #32
0
#!/usr/bin/python
"""KDE support for dpaste"""
import sys, time
import dcop
import dcopext
from kdecore import KApplication, KCmdLineArgs, KAboutData
from qt import QString, QCString

import StringIO
import dpaster

description = "KDE interface to http://dpaste.com/"
version = "0.1"
aboutData   = KAboutData ("testdcopext", "testdcopext",\
    version, description, KAboutData.License_GPL,\
    "(C) 2007 Peter Fein")

aboutData.addAuthor("Peter Fein", "wrote it", "*****@*****.**")

KCmdLineArgs.init(sys.argv, aboutData)

app = KApplication()
dcop = app.dcopClient()

d = dcopext.DCOPApp("klipper", dcop)
res, content = d.klipper.getClipboardContents()
sio = StringIO.StringIO(content)
url = dpaster.paste(sio)
res = d.klipper.setClipboardContents(url)
Example #33
0
 def warncontinue(message):
     return KMessageBox.warningContinueCancel(
         KApplication.kApplication().mainWidget(), message
         ) == KMessageBox.Continue
Example #34
0
def makeCaption(title):
    """Create a standard window caption"""
    return KApplication.kApplication().makeStdCaption(i18n(title))
Example #35
0
 def info(message, **a):
     KMessageBox.information(
         KApplication.kApplication().mainWidget(), message)
Example #36
0
#!/usr/bin/python
# -*- coding: utf-8 -*-

import sys

from kdecore import KApplication, KAboutData, KCmdLineArgs, KGlobal, KIcon
from qt import QObject, SIGNAL, SLOT

from pakito.gui.mainwindow import MainWindow

def I18N_NOOP(x):
    return x

name = "Pakito"
version = "0.3"
mail = "*****@*****.**"
description = I18N_NOOP("A tool for accelerating package making process")

if __name__ == "__main__":    
    about = KAboutData(name.lower(), name, version, description, KAboutData.License_GPL_V2, "(C) Gökçen Eraslan 2007", None, None, mail)
    about.addAuthor("Gökçen Eraslan", None, mail)
    KCmdLineArgs.init(sys.argv, about)
    app = KApplication()
    programLogo = KGlobal.iconLoader().loadIcon("pisikga", KIcon.Desktop)
    about.setProgramLogo(programLogo.convertToImage())
    QObject.connect(app, SIGNAL("lastWindowClosed()"), app, SLOT("quit()"))
    pac = MainWindow(None, name)
    app.setMainWidget(pac)
    pac.show()
    app.exec_loop()
 def setMainWidget(self, win):
     self.mainwindow = win
     KApplication.setMainWidget(self, win)