Python gi.repository.GLib 模块,set_application_name() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用gi.repository.GLib.set_application_name()

项目:Icon-Requests    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.gnome.IconRequests",
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(_("Icon Requests"))
        GLib.set_prgname("Icon Requests")


        Gtk.Settings.get_default().set_property(
            "gtk-application-prefer-dark-theme", settings.get_is_night_mode())

        self.menu = Gio.Menu()
        cssProviderFile = Gio.File.new_for_uri(
            'resource:///org/gnome/IconRequests/css/style.css')
        cssProvider = Gtk.CssProvider()
        screen = Gdk.Screen.get_default()
        styleContext = Gtk.StyleContext()
        try:
            cssProvider.load_from_file(cssProviderFile)
            styleContext.add_provider_for_screen(screen, cssProvider,
                                                 Gtk.STYLE_PROVIDER_PRIORITY_USER)
            logging.debug("Loading css file ")
        except Exception as e:
            logging.error("Error message %s" % str(e))
项目:Gnome-Authenticator    作者:bil-elmoussaoui    | 项目源码 | 文件源码
def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.gnome.Authenticator",
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(_("Gnome Authenticator"))
        GLib.set_prgname("Gnome Authenticator")

        self.observable = ApplicaitonObservable()

        self.menu = Gio.Menu()
        self.db = Database()

        result = GK.unlock_sync("org.gnome.Authenticator", None)
        if result == GK.Result.CANCELLED:
            self.quit()

        Gtk.Settings.get_default().set_property(
            "gtk-application-prefer-dark-theme", settings.get_is_night_mode())

        if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:
            cssFileName = "org.gnome.Authenticator-post3.20.css"
        else:
            cssFileName = "org.gnome.Authenticator-pre3.20.css"
        cssProviderFile = Gio.File.new_for_uri(
            'resource:///org/gnome/Authenticator/%s' % cssFileName)
        cssProvider = Gtk.CssProvider()
        screen = Gdk.Screen.get_default()
        styleContext = Gtk.StyleContext()
        try:
            cssProvider.load_from_file(cssProviderFile)
            styleContext.add_provider_for_screen(screen, cssProvider,
                                                 Gtk.STYLE_PROVIDER_PRIORITY_USER)
            logging.debug("Loading css file ")
        except Exception as e:
            logging.error("Error message %s" % str(e))
项目:Ebook-Viewer    作者:michaldaniel    | 项目源码 | 文件源码
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)
项目:ez_gpg    作者:sgnn7    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super().__init__(*args, application_id="org.sgnn7.ezgpg",
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
                         **kwargs)

        GLib.set_application_name("Ez Gpg")
        GLib.set_prgname('EZ GPG')

        self._window = None
        self._encrypt_window = None

        self._actions = [
            ('about', True, self.on_about),
            ('quit',  True, self.on_quit),
        ]
项目:chromecast-player    作者:wa4557    | 项目源码 | 文件源码
def __init__(self, uri, show_gui=True):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.chromecast-player',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name("Chromecast Player")
        GLib.set_prgname('chromecast-player')
        self.connect("activate", self._on_activate, uri)
        self.cast = None
        self.mc = None
        self.get_chromecast_config()
        self.uri = None
        self.play_now = True if uri else False
        self.play_uri = []
        self.serverthread = None
        self.subtitlethread = None
        self.local_port = 0
        self.show_gui = show_gui
        self.imagethread = None
        self.transcode_options = None
        self.playlist_manager = None
        if uri and not isinstance(uri, (list, tuple)):
            self.uri = [uri]
        elif uri:
            self.uri = uri
        self.loaded = False
        self.loc_file = None
        self.stop_worker = False
        self.is_playing = False
        self.is_paused = False
        self.is_idle = False
        self.is_disconnected = False
        self.playlist_counter = 0
        self.seeking = False
        self.overwrite = False
        self.continue_playing = False
        self.volume_changing = False
项目:luminance    作者:craigcabrey    | 项目源码 | 文件源码
def __init__(self, bridge, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.bridge = bridge

        GLib.set_application_name('Luminance')
        self.set_position(Gtk.WindowPosition.CENTER)
        self.set_icon_name('luminance')

        builder = Gtk.Builder()
        builder.add_from_resource(get_resource_path('ui/main.ui'))
        builder.connect_signals(self)

        self.header_bar = builder.get_object('headerbar')
        self.status_bar = builder.get_object('status-bar')

        self.main_content = builder.get_object('main-content')
        self.main_stack = builder.get_object('main-stack')

        self.lights_page = builder.get_object('lights-page')
        self.lights_page.add(FramedEntityList(self.bridge.get_light_objects('id').values()))

        self.groups_page = builder.get_object('groups-page')
        self.groups_page.add(Groups(self.bridge))

        self.bridge_page = builder.get_object('bridge-page')
        self.bridge_page.add(Bridge(self.bridge))

        self._on_connection_change()

        geometry = Gdk.Geometry()
        geometry.min_height = 450
        geometry.min_width = 575
        self.set_geometry_hints(None, geometry, Gdk.WindowHints.MIN_SIZE)
        self.set_titlebar(self.header_bar)

        self.add(self.main_content)
项目:pytimetrack    作者:fhackerz    | 项目源码 | 文件源码
def __init__(self):
        super(Application, self).__init__(
            application_id='org.gtimelog',
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
        )
        GLib.set_application_name(_("Time Log"))
        GLib.set_prgname('gtimelog')
        self.add_main_option_entries([
            make_option("--version", description=_("Show version number and exit")),
            make_option("--debug", description=_("Show debug information on the console")),
        ])
项目:python-sense-emu    作者:RPi-Distro    | 项目源码 | 文件源码
def __init__(self, *args, **kwargs):
        super(EmuApplication, self).__init__(
                *args, application_id='org.raspberrypi.sense_emu_gui',
                flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
                **kwargs)
        GLib.set_application_name(_('Sense HAT Emulator'))
        self.window = None
项目:kickoff-player    作者:jonian    | 项目源码 | 文件源码
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()