本文整理汇总了Python中PyKDE4.kdeui.KApplication类的典型用法代码示例。如果您正苦于以下问题:Python KApplication类的具体用法?Python KApplication怎么用?Python KApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: main
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 = "[email protected]"
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_()
示例2: __init__
def __init__(self, argv, opts):
"""
Constructor
@param argv command line arguments
@param opts acceptable command line options
"""
loc = _localeString()
os.environ["KDE_LANG"] = loc
aboutData = KAboutData(
Program, "kdelibs", ki18n(Program), Version, ki18n(""),
KAboutData.License_GPL, ki18n(Copyright), ki18n ("none"),
Homepage, BugAddress)
sysargv = argv[:]
KCmdLineArgs.init(sysargv, aboutData)
if opts:
options = KCmdLineOptions()
for opt in opts:
if len(opt) == 2:
options.add(opt[0], ki18n(opt[1]))
else:
options.add(opt[0], ki18n(opt[1]), opt[2])
KCmdLineArgs.addCmdLineOptions(options)
KApplication.__init__(self, True)
KQApplicationMixin.__init__(self)
示例3: start
def start():
appName = Config.appname
catalog = Config.catalog
programName = ki18n(Config.readable_appname)
version = Config.version
description = ki18n("A tablet annotation and journaling application.")
license = KAboutData.License_BSD
copyright = ki18n("(C) 2009 Dominik Schacht")
text = ki18n("Whee, greetings.")
homepage = Config.homepage
bugemail = "[email protected]"
aboutData = KAboutData(appName, catalog, programName, version, description, license, copyright, text, homepage, bugemail)
KCmdLineArgs.init(sys.argv, aboutData)
KCmdLineArgs.addCmdLineOptions(Config.get_param_options())
app = KApplication()
Config.init_config() # Init after the KApplication has been created.
mw = MainWindow()
mw.show()
result = app.exec_()
return result
示例4: main
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 = "[email protected]"
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_()
示例5: main
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 = "[email protected]"
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_ ()
示例6: main
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'),
'[email protected]')
about.addCredit(ki18n('Valentyn Pavliuchenko'),
ki18n('Debian packaging, russian translation, '
'bug reporting and testing'),
'[email protected]')
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_()
示例7: pulse
def pulse(self, owner):
super(KDEFetchProgressAdapter, self).pulse(owner)
at_item = min(self.current_items + 1, self.total_items)
if self.current_cps > 0:
self.label.setText(_("Downloading additional package files...") + _("File %s of %s at %sB/s" % (at_item, self.total_items, apt_pkg.size_to_str(self.current_cps))))
else:
self.label.setText(_("Downloading additional package files...") + _("File %s of %s" % (at_item, self.total_items)))
self.progress.setValue(100 * self.current_bytes / self.total_bytes)
KApplication.kApplication().processEvents()
return True
示例8: __init__
def __init__(self, datadir, component_data=None, parent=None):
LanguageSelectorBase.__init__(self, datadir)
KCModule.__init__(self, component_data, parent)
self.parentApp = KApplication.kApplication()
self.ui = Ui_QtLanguageSelectorGUI()
self.ui.setupUi(self)
self.about = MakeAboutData()
self.setAboutData(self.about)
self.setWindowIcon(KIcon("preferences-desktop-locale"))
self.imSwitch = ImSwitch()
# remove dangling ImSwitch symlinks if present
self.imSwitch.removeDanglingSymlinks()
self.init()
# connect the signals
self.connect(self.ui.listViewLanguagesInst, SIGNAL("itemSelectionChanged()"), self.checkInstallableComponents)
self.connect(self.ui.listViewLanguagesUninst, SIGNAL("itemSelectionChanged()"), self.onChanged)
self.connect(self.ui.ktabwidget, SIGNAL("currentChanged(int)"), self.onTabChangeRevertApply)
self.connect(self.ui.listBoxDefaultLanguage, SIGNAL("itemSelectionChanged()"), self.checkInputMethods)
self.connect(self.ui.checkBoxTr, SIGNAL("stateChanged(int)"), self.onChanged)
self.connect(self.ui.checkBoxIm, SIGNAL("stateChanged(int)"), self.onChanged)
self.connect(self.ui.checkBoxSpell, SIGNAL("stateChanged(int)"), self.onChanged)
self.connect(self.ui.checkBoxFonts, SIGNAL("stateChanged(int)"), self.onChanged)
示例9: main
def main():
"""Creates an application from the cmd line args and starts a editor window"""
KCmdLineArgs.init(sys.argv, ABOUT)
opts = KCmdLineOptions()
opts.add('+[file]', ki18n('File to open'))
KCmdLineArgs.addCmdLineOptions(opts)
args = KCmdLineArgs.parsedArgs()
urls = [args.url(i) for i in range(args.count())] #wurgs
app = KApplication()
#KGlobal.locale().setLanguage(['de']) TODO
win = Markdowner(urls)
win.show()
sys.exit(app.exec_())
示例10: __init__
def __init__(self, servicePrefix):
# We manage our own documents.
self.documents = []
self.history = [] # latest shown documents
# KApplication needs to be instantiated before any D-Bus stuff
self.kapp = KApplication()
# Here we can setup config() stuff before MainWindow and its tools
# are created.
config = KGlobal.config().group("") # root group
self.setupConfiguration(config)
config.sync()
# DBus init
serviceName = "{0}{1}".format(servicePrefix, os.getpid())
DBusItem.__init__(self, serviceName, '/MainApp')
# We support only one MainWindow.
self.mainwin = self.createMainWindow()
self.kapp.setTopWidget(self.mainwin)
# Get our beloved editor :-)
self.editor = KTextEditor.EditorChooser.editor()
self.editor.readConfig()
# restore session etc.
self._sessionStartedFromCommandLine = False
示例11: busyCursor
def busyCursor(self, cursor=None):
"""Performs code with a busy cursor set for the application.
The default cursor to use is the Qt.WaitCursor. Usage:
with app.busyCursor():
...
"""
if cursor is None:
cursor = QCursor(Qt.WaitCursor)
KApplication.setOverrideCursor(cursor)
try:
yield
finally:
KApplication.restoreOverrideCursor()
示例12: initUI
def initUI(self):
global config
backupTitle = QtGui.QLabel('Backup Volume:')
self.backupVolumeTitle = QtGui.QLabel(config.backupName)
self.manageBackupButton = QtGui.QPushButton('Manage Backup Volumes')
self.managePathsButton = QtGui.QPushButton('Manage Sync Paths')
toplevel = QtGui.QHBoxLayout()
toplevel.addWidget(backupTitle)
toplevel.addWidget(self.backupVolumeTitle)
toplevel.addWidget(self.manageBackupButton)
secondlevel = QtGui.QHBoxLayout()
progressTitle = QtGui.QLabel('Syncing Progress:')
self.progressDetail = QtGui.QLabel('Stopped.')
secondlevel.addWidget(progressTitle)
secondlevel.addWidget(self.progressDetail)
secondlevel.addWidget(self.managePathsButton)
gridv = QtGui.QVBoxLayout()
gridv.addLayout(toplevel)
gridv.addLayout(secondlevel)
self.setLayout(gridv)
self.setWindowTitle("Backup2isp")
self.move( KApplication.desktop().screen().rect().center() - self.rect().center() )
self.manageBackupButton.connect(self.manageBackupButton, QtCore.SIGNAL("clicked()"), self.manageBackups)
self.managePathsButton.connect(self.managePathsButton, QtCore.SIGNAL("clicked()"), self.managePaths)
self.beginBackup()
示例13: __init__
def __init__(self):
aboutData = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME, VERSION, DESCRIPTION,
LICENSE, COPYRIGHT, TEXT, HOMEPAGE, BUG_EMAIL)
aboutData.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "[email protected]", "")
aboutData.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "[email protected]", "")
aboutData.setProgramIconName(common.ICON_FILE)
self.aboutData = aboutData
aboutData_py3 = KAboutData(APP_NAME, CATALOG, PROGRAM_NAME_PY3, VERSION, DESCRIPTION_PY3,
LICENSE, COPYRIGHT_PY3, TEXT, HOMEPAGE_PY3, BUG_EMAIL_PY3)
aboutData_py3.addAuthor(ki18n("GuoCi"), ki18n("Python 3 port maintainer"), "[email protected]", "")
aboutData_py3.addAuthor(ki18n("Chris Dekter"), ki18n("Developer"), "[email protected]", "")
aboutData_py3.addAuthor(ki18n("Sam Peterson"), ki18n("Original developer"), "[email protected]", "")
aboutData_py3.setProgramIconName(common.ICON_FILE)
self.aboutData_py3 = aboutData_py3
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)
# 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)
示例14: __init__
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 = "[email protected]"
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()
示例15: update_interface
def update_interface(self):
# run the base class
try:
InstallProgress.update_interface(self)
except ValueError as e:
pass
# log the output of dpkg (on the master_fd) to the DumbTerminal
while True:
try:
(rlist, wlist, xlist) = select.select([self.master_fd],[],[], 0.01)
# data available, read it
if len(rlist) > 0:
line = os.read(self.master_fd, 255)
self.parent.konsole.insertWithTermCodes(utf8(line))
else:
# nothing happend within the timeout, break
break
except Exception as e:
logging.debug("update_interface: %s" % e)
break
KApplication.kApplication().processEvents()