本文整理汇总了Python中gi.repository.GLib.set_prgname方法的典型用法代码示例。如果您正苦于以下问题:Python GLib.set_prgname方法的具体用法?Python GLib.set_prgname怎么用?Python GLib.set_prgname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gi.repository.GLib
的用法示例。
在下文中一共展示了GLib.set_prgname方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self, version):
super().__init__(application_id=APP_ID,
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
GLib.set_application_name('Dynamic Wallpaper Editor')
GLib.set_prgname(APP_ID)
self.connect('startup', self.on_startup)
self.connect('activate', self.on_activate)
self.connect('command-line', self.on_cli)
self.register(None)
self._version = version
self._git_url = 'https://github.com/maoschanz/dynamic-wallpaper-editor'
self.add_main_option('version', b'v', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Tell the version of the app"), None)
self.add_main_option('new-window', b'n', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Open a new window"), None)
示例2: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self):
Gtk.Application.__init__(self,
application_id="com.github.bilelmoussaoui.Authenticator",
flags=Gio.ApplicationFlags.FLAGS_NONE)
GLib.set_application_name(_("Authenticator"))
GLib.set_prgname("Authenticator")
self.alive = True
self._menu = Gio.Menu()
示例3: do_startup
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def do_startup(self):
Gtk.Application.do_startup(self)
GLib.set_application_name('ImEditor')
GLib.set_prgname(APP_ID)
self.connect('open', self.file_open_handler)
示例4: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self):
GLib.set_prgname('kickoff-player')
GLib.set_application_name('Kickoff Player')
add_custom_css('ui/styles.css')
self.argparse = argparse.ArgumentParser(prog='kickoff-player')
self.argparse.add_argument('url', metavar='URL', nargs='?', default=None)
self.cache = CacheHandler()
self.data = DataHandler()
self.scores_api = ScoresApi(self.data, self.cache)
self.streams_api = StreamsApi(self.data, self.cache)
self.main = Gtk.Builder()
self.main.add_from_file(relative_path('ui/main.ui'))
self.main.connect_signals(self)
self.window = self.main.get_object('window_main')
self.header_back = self.main.get_object('header_button_back')
self.header_reload = self.main.get_object('header_button_reload')
self.main_stack = self.main.get_object('stack_main')
self.player_stack = self.main.get_object('stack_player')
self.matches_stack = self.main.get_object('stack_matches')
self.channels_stack = self.main.get_object('stack_channels')
self.matches = MatchHandler(self)
self.channels = ChannelHandler(self)
self.player = PlayerHandler(self)
GLib.timeout_add(2000, self.toggle_reload, True)
self.open_stream_url()
示例5: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self):
Gtk.Application.__init__(self,
application_id="com.github.bilelmoussaoui.AudioCutter",
flags=Gio.ApplicationFlags.FLAGS_NONE)
GLib.set_application_name(_("Audio Cutter"))
GLib.set_prgname("Audio Cutter")
self.app_menu = Gio.Menu()
self._setup_css()
Application.instance = self
示例6: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self, *args, **kwargs):
super().__init__(*args, application_id="easy-ebook-viewer",
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
**kwargs)
self.window = None
self.file_path = None
GLib.set_application_name('Easy eBook Viewer')
GLib.set_prgname('easy-ebook-viewer')
GLib.setenv('PULSE_PROP_application.icon_name', 'easy-ebook-viewer', True)
示例7: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self, version):
super().__init__(application_id=APP_ID,
flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
GLib.set_application_name(_("Drawing"))
GLib.set_prgname(APP_ID)
self._version = version
self.has_tools_in_menubar = False
self.connect('startup', self.on_startup)
self.register(None)
self.connect('activate', self.on_activate)
self.connect('command-line', self.on_cli)
self.add_main_option('version', b'v', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Show the app version"), None)
self.add_main_option('new-window', b'n', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Open a new window"), None)
self.add_main_option('new-tab', b't', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Open a new tab"), None)
self.add_main_option('edit-clipboard', b'c', GLib.OptionFlags.NONE,
GLib.OptionArg.NONE, _("Edit the clipboard content"), None)
icon_theme = Gtk.IconTheme.get_default()
icon_theme.add_resource_path(APP_PATH + '/icons')
icon_theme.add_resource_path(APP_PATH + '/tools/icons')
示例8: __init__
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def __init__(self):
setproctitle.setproctitle("GPT")
self.install_dir = os.getcwd()
self.user_app_dir = os.path.join(os.path.expanduser("~"),
".config",
"gpt",
)
# create hidden app folder in user"s home directory if it does
# not exist
if not os.path.isdir(self.user_app_dir):
os.makedirs(self.user_app_dir)
# initiate GTK+ application
GLib.set_prgname("GPT")
# set up logging
os.chdir(self.user_app_dir)
self.log = logging.getLogger("gpt")
with open(os.path.join(self.install_dir, "logging.yaml")) as f:
config = yaml.load(f)
logging.config.dictConfig(config)
self.loglevels = {"critical": 50,
"error": 40,
"warning": 30,
"info": 20,
"debug": 10,
}
# log version info for debugging
self.log.debug("Application version: {}".format(__version__))
self.log.debug("GTK+ version: {}.{}.{}".format(Gtk.get_major_version(),
Gtk.get_minor_version(),
Gtk.get_micro_version(),
))
self.log.debug(_("Application executed from {}").format(self.install_dir))
self.locales_dir = os.path.join(self.install_dir, "po", "locale")
self.appname = "GPT"
# setting up localization
locale.bindtextdomain(self.appname, self.locales_dir)
locale.textdomain(self.locales_dir)
gettext.bindtextdomain(self.appname, self.locales_dir)
gettext.textdomain(self.appname)
# check for config file to set up working directory
# create file in case it does not exist
self.config = os.path.join(self.user_app_dir, "config.py")
self.defaultwdir = os.path.join(os.path.expanduser("~"), "GP")
if os.path.isfile(self.config):
self.readconfig()
else:
self.stdir = self.defaultwdir
self.chkdir(self.stdir)
self.createconfig(self.stdir)
self.kd_supp = True
self.show_message(_("Working directory: {}").format(self.stdir))
示例9: main
# 需要导入模块: from gi.repository import GLib [as 别名]
# 或者: from gi.repository.GLib import set_prgname [as 别名]
def main():
parser = argparse.ArgumentParser(prog='KingPhisher', description='King Phisher Client GUI', conflict_handler='resolve')
utilities.argp_add_args(parser, default_root='KingPhisher')
startup.argp_add_client(parser)
arguments = parser.parse_args()
# basic runtime checks
if sys.version_info < (3, 4):
color.print_error('the Python version is too old (minimum required is 3.4)')
return 0
if Gtk.check_version(3, 14, 0):
color.print_error('the GTK+ version is too old (minimum required is 3.14)')
return 0
if sys.platform.startswith('linux') and not os.environ.get('DISPLAY'):
color.print_error('no display was detected, this must be run with an interactive X session')
return 0
config_file = arguments.config_file
use_plugins = arguments.use_plugins
use_style = arguments.use_style
del arguments, parser
logger = logging.getLogger('KingPhisher.Client.CLI')
if sys.platform.startswith('linux') and not os.getuid():
logger.warning('it is not necessary to run the king phisher client as root')
find.init_data_path('client')
if not gui_utilities.which_glade():
color.print_error('unable to locate the glade ui data file')
return 0
logger.debug("king phisher version: {0} python version: {1}.{2}.{3}".format(version.version, sys.version_info[0], sys.version_info[1], sys.version_info[2]))
logger.debug("client running in process: {0} main tid: 0x{1:x}".format(os.getpid(), threading.current_thread().ident))
GLib.set_application_name('King Phisher')
GLib.set_prgname('King Phisher')
start_time = time.time()
logger.debug('using ui data from glade file: ' + gui_utilities.which_glade())
try:
app = application.KingPhisherClientApplication(config_file=config_file, use_plugins=use_plugins, use_style=use_style)
except Exception as error:
logger.critical("initialization error: {0} ({1})".format(error.__class__.__name__, getattr(error, 'message', 'n/a')))
color.print_error('failed to initialize the King Phisher client')
return 0
logger.debug("client loaded in {0:.2f} seconds".format(time.time() - start_time))
GObject.threads_init()
return app.run([])