当前位置: 首页>>代码示例>>Python>>正文


Python GLib.set_prgname方法代码示例

本文整理汇总了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) 
开发者ID:maoschanz,项目名称:dynamic-wallpaper-editor,代码行数:19,代码来源:main.py

示例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() 
开发者ID:bilelmoussaoui,项目名称:Authenticator,代码行数:10,代码来源:application.py

示例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) 
开发者ID:ImEditor,项目名称:ImEditor,代码行数:8,代码来源:main.py

示例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() 
开发者ID:jonian,项目名称:kickoff-player,代码行数:36,代码来源:kickoff_player.py

示例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 
开发者ID:bilelmoussaoui,项目名称:Audio-Cutter,代码行数:11,代码来源:application.py

示例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) 
开发者ID:michaldaniel,项目名称:ebook-viewer,代码行数:11,代码来源:main.py

示例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') 
开发者ID:maoschanz,项目名称:drawing,代码行数:28,代码来源:main.py

示例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)) 
开发者ID:encarsia,项目名称:gpt,代码行数:63,代码来源:modules.py

示例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([]) 
开发者ID:rsmusllp,项目名称:king-phisher,代码行数:54,代码来源:__main__.py


注:本文中的gi.repository.GLib.set_prgname方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。