Beispiel #1
0
    def __init__(self):
        super().__init__(
            application_id="net.lutris.Lutris",
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
        )
        init_lutris()
        gettext.bindtextdomain("lutris", "/usr/share/locale")
        gettext.textdomain("lutris")

        GLib.set_application_name(_("Lutris"))
        self.running_games = Gio.ListStore.new(Game)
        self.window = None
        self.tray = None
        self.css_provider = Gtk.CssProvider.new()
        self.run_in_background = False

        if os.geteuid() == 0:
            ErrorDialog(
                "Running Lutris as root is not recommended and may cause unexpected issues"
            )

        try:
            self.css_provider.load_from_path(
                os.path.join(datapath.get(), "ui", "lutris.css")
            )
        except GLib.Error as e:
            logger.exception(e)

        if hasattr(self, "add_main_option"):
            self.add_arguments()
        else:
            ErrorDialog(
                "Your Linux distribution is too old. Lutris won't function properly."
            )
Beispiel #2
0
    def __init__(self):

        Gtk.Application.__init__(self, application_id='net.lutris.Lutris',
                                 flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)

        gettext.bindtextdomain("lutris", "/usr/share/locale")
        gettext.textdomain("lutris")

        check_config()
        migrate()
        update_platforms()

        GLib.set_application_name(_('Lutris'))
        self.window = None
        self.css_provider = Gtk.CssProvider.new()

        try:
            self.css_provider.load_from_path(os.path.join(datapath.get(), 'ui', 'lutris.css'))
        except GLib.Error as e:
            logger.exception(e)

        if hasattr(self, 'add_main_option'):
            self.add_arguments()
        else:
            ErrorDialog("Your Linux distribution is too old, Lutris won't function properly")
Beispiel #3
0
	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.runs_in_sandbox = 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,
		                     # Description of a command line option
		                     GLib.OptionArg.NONE, _("Show the app version"), None)
		self.add_main_option('new-window', b'n', GLib.OptionFlags.NONE,
		                     # Description of a command line option
		                     GLib.OptionArg.NONE, _("Open a new window"), None)
		self.add_main_option('new-tab', b't', GLib.OptionFlags.NONE,
		                     # Description of a command line option
		                     GLib.OptionArg.NONE, _("Open a new tab"), None)
		self.add_main_option('edit-clipboard', b'c', GLib.OptionFlags.NONE,
		             # Description of a command line option
		             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')
Beispiel #4
0
def set_application_info(app):
    """Call after init() and before creating any windows to apply default
    values for names and icons.
    """

    from quodlibet._init import is_init

    assert is_init()

    from gi.repository import Gtk, GLib

    assert app.process_name
    set_process_title(app.process_name)
    # Issue 736 - set after main loop has started (gtk seems to reset it)
    GLib.idle_add(set_process_title, app.process_name)

    assert app.id
    # https://honk.sigxcpu.org/con/GTK__and_the_application_id.html
    GLib.set_prgname(app.id)
    assert app.name
    GLib.set_application_name(app.name)

    assert app.icon_name
    theme = Gtk.IconTheme.get_default()
    assert theme.has_icon(app.icon_name)
    Gtk.Window.set_default_icon_name(app.icon_name)
Beispiel #5
0
    def __init__(self):
        logger.debug("instantiating application...")
        app_id = "org.{}.app".format(__appname__.lower())
        super().__init__(application_id=app_id,
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(__appname__)

        self.builder = Gtk.Builder.new_from_file(str(BASEDIR /
                                                     "xpl/xpl.glade"))
        self.builder.add_from_file(str(BASEDIR / "xpl/menubar.ui"))

        self.dh = DataHandler()
        self.view = XPLView(self.builder, self.dh)
        self.view.set_region_boundary_setter(self.dh.manipulate_region)

        statusbar = self.builder.get_object("statusbar")
        self.statusbar_id = statusbar.get_context_id("")

        self.win = None

        self.add_main_option_entries([
            make_option("--verbosity",
                        "-v",
                        arg=GLib.OptionArg.INT,
                        description="Value from 1 (only errors) to 4 (debug)"),
            make_option("--version", description="show program version"),
        ])
 def __init__(self):
     super().__init__({
         application_id: 'org.gnome.Music',
         flags: gio.ApplicationFlags.FLAGS_NONE,
         inactivity_timeout: 12000}
     )
     GLib.set_application_name("Music")
    def set_id(self):
        self.keyfile = GLib.KeyFile()
        desktop = os.path.join(RUNTIME_BUILT, self.id + '.desktop')
        if os.path.exists(desktop):
            self.keyfile.load_from_file(desktop, GLib.KeyFileFlags.NONE)
        else:
            self.keyfile.load_from_data_dirs(
                'applications/%s.desktop' % self.id, GLib.KeyFileFlags.NONE)

        self.name = self.keyfile.get_string(GLib.KEY_FILE_DESKTOP_GROUP,
                                            GLib.KEY_FILE_DESKTOP_KEY_NAME)
        logger.debug('Name: %s', self.name)
        GLib.set_application_name(self.name)

        self.icon_name = self.keyfile.get_string(
            GLib.KEY_FILE_DESKTOP_GROUP, GLib.KEY_FILE_DESKTOP_KEY_ICON)
        logger.debug('Icon: %s', self.icon_name)

        self.expansion_name = self.args.expansion

        try:
            override_id = self.keyfile.get_string(
                GLib.KEY_FILE_DESKTOP_GROUP, 'X-GameDataPackager-ExpansionFor')
        except GLib.Error:
            pass
        else:
            if self.expansion_name is None:
                self.expansion_name = self.id

            if self.expansion_name.startswith(override_id + '-'):
                self.expansion_name = self.expansion_name[len(override_id) +
                                                          1:]

            self.id = override_id
Beispiel #8
0
	def __init__(self, tidal):
		self.tidal = tidal

		self.event_handlers = GUIEventHandlers(self)

		GLib.set_application_name('Undercurrent')
		self.builder = Gtk.Builder()
		self.builder.add_from_file('undercurrent.glade')
		self.builder.connect_signals(self.event_handlers)

		css_provider = Gtk.CssProvider()
		css_provider.load_from_path('undercurrent.css')
		context = Gtk.StyleContext()
		screen = Gdk.Screen.get_default()
		context.add_provider_for_screen(screen, css_provider, Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION)

		self.window = self.builder.get_object('main_window')
		self.window.set_wmclass("Undercurrent", "Undercurrent")
		self.window.show_all()

		self.tracklist = self.builder.get_object('tracklist')
		self.tracklist.set_filter_func(self.tracklist_filter_func)

		self.status_progress = self.builder.get_object('status_progress')
		self.playlists = self.builder.get_object('playlists')
		self.playback_timer = self.builder.get_object('status_playback_timer')
		self.play_button_image = self.builder.get_object('play_button_image')

		GObject.timeout_add_seconds(1, self.update_playback_progress)
Beispiel #9
0
    def __init__(self, version, *args, **kwargs):
        super().__init__(*args, **kwargs)

        GLib.set_application_name(APPLICATION_NAME)
        GLib.set_prgname(PRGNAME)
        self.set_application_id(APPLICATION_ID)
        self.application_version = version
Beispiel #10
0
 def __init__(self, extension_dir):
     """
         Create application
         @param extension_dir as str
     """
     Gtk.Application.__init__(
         self,
         application_id='org.gnome.Eolie',
         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
     self.set_property('register-session', True)
     # Ideally, we will be able to delete this once Flatpak has a solution
     # for SSL certificate management inside of applications.
     if GLib.file_test("/app", GLib.FileTest.EXISTS):
         paths = [
             "/etc/ssl/certs/ca-certificates.crt", "/etc/pki/tls/cert.pem",
             "/etc/ssl/cert.pem"
         ]
         for path in paths:
             if GLib.file_test(path, GLib.FileTest.EXISTS):
                 GLib.setenv('SSL_CERT_FILE', path, True)
                 break
     self.__extension_dir = extension_dir
     self.__windows = []
     self.debug = False
     self.cursors = {}
     GLib.set_application_name('Eolie')
     GLib.set_prgname('eolie')
     self.connect('activate', self.__on_activate)
     self.connect('command-line', self.__on_command_line)
     self.register(None)
     if self.get_is_remote():
         Gdk.notify_startup_complete()
Beispiel #11
0
    def __init__(self):
        super().__init__(
            application_id="net.lutris.Lutris",
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
        )
        init_lutris()
        gettext.bindtextdomain("lutris", "/usr/share/locale")
        gettext.textdomain("lutris")

        GLib.set_application_name(_("Lutris"))
        self.running_games = Gio.ListStore.new(Game)
        self.window = None
        self.tray = None
        self.css_provider = Gtk.CssProvider.new()
        self.run_in_background = False

        if os.geteuid() == 0:
            ErrorDialog(
                "Running Lutris as root is not recommended and may cause unexpected issues"
            )

        try:
            self.css_provider.load_from_path(
                os.path.join(datapath.get(), "ui", "lutris.css"))
        except GLib.Error as e:
            logger.exception(e)

        if hasattr(self, "add_main_option"):
            self.add_arguments()
        else:
            ErrorDialog(
                "Your Linux distribution is too old. Lutris won't function properly."
            )
Beispiel #12
0
    def __init__(self):
        super().__init__(
            application_id="net.lutris.Lutris",
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
        )

        GObject.add_emission_hook(Game, "game-launch", self.on_game_launch)
        GObject.add_emission_hook(Game, "game-start", self.on_game_start)
        GObject.add_emission_hook(Game, "game-stop", self.on_game_stop)
        GObject.add_emission_hook(Game, "game-install", self.on_game_install)

        GLib.set_application_name(_("Lutris"))
        self.window = None

        self.running_games = Gio.ListStore.new(Game)
        self.app_windows = {}
        self.tray = None
        self.css_provider = Gtk.CssProvider.new()
        self.run_in_background = False

        if os.geteuid() == 0:
            ErrorDialog(_("Running Lutris as root is not recommended and may cause unexpected issues"))

        try:
            self.css_provider.load_from_path(os.path.join(datapath.get(), "ui", "lutris.css"))
        except GLib.Error as e:
            logger.exception(e)

        if hasattr(self, "add_main_option"):
            self.add_arguments()
        else:
            ErrorDialog(_("Your Linux distribution is too old. Lutris won't function properly."))
Beispiel #13
0
    def __init__(self, version):
        super().__init__(application_id=APP_ID,
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)

        GLib.set_application_name('Drawing')  # XXX drawing ?
        GLib.set_prgname(APP_ID)
        self.version = version
        self.git_url = 'https://github.com/maoschanz/drawing'
        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,
            _("Print the version and display the 'about' dialog"), 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)
        # TODO options pour le screenshot ?

        icon_theme = Gtk.IconTheme.get_default()
        icon_theme.add_resource_path('/com/github/maoschanz/drawing/icons')
        icon_theme.add_resource_path(
            '/com/github/maoschanz/drawing/tools/icons')
Beispiel #14
0
    def __init__(self):
        super().__init__(application_id=pkg.name, flags=pkg.appFlags)

        if self.get_flags() & Gio.ApplicationFlags.IS_SERVICE:
            self.set_inactivity_timeout(60000)

        GLib.set_application_name(_("Assetxplorer"))
Beispiel #15
0
def main():
    try:
        if sys.platform.startswith('win'):
            # Load theming under Windows
            _windows_load_theme()

        itheme: Gtk.IconTheme = Gtk.IconTheme.get_default()
        itheme.append_search_path(os.path.abspath(icons()))
        itheme.append_search_path(
            os.path.abspath(os.path.join(get_debugger_data_dir(), "icons")))
        itheme.rescan_if_needed()

        # Load Builder and Window
        builder = get_debugger_builder()
        main_window: Window = builder.get_object("main_window")
        main_window.set_role("SkyTemple Script Engine Debugger")
        GLib.set_application_name("SkyTemple Script Engine Debugger")
        GLib.set_prgname("skytemple_ssb_debugger")
        # TODO: Deprecated but the only way to set the app title on GNOME...?
        main_window.set_wmclass("SkyTemple Script Engine Debugger",
                                "SkyTemple Script Engine Debugger")

        # Load main window + controller
        MainController(builder, main_window,
                       StandaloneDebuggerControlContext(main_window))

        Gtk.main()
    finally:
        if EmulatorThread.instance():
            EmulatorThread.instance().stop()
Beispiel #16
0
    def init_ui(self):
        GLib.set_application_name("Pithos")
        Gtk.Window.set_default_icon_name('pithos')
        os.environ['PULSE_PROP_media.role'] = 'music'

        self.volume.set_relief(Gtk.ReliefStyle.NORMAL)  # It ignores glade...
        self.settings.bind('volume', self.volume, 'value', Gio.SettingsBindFlags.DEFAULT)

        self.songs_treeview.set_model(self.songs_model)

        title_col   = Gtk.TreeViewColumn()

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, False)
        title_col.add_attribute(render_icon, "icon", 2)
        title_col.add_attribute(render_icon, "pixbuf", 3)

        render_text = Gtk.CellRendererText()
        render_text.props.ellipsize = Pango.EllipsizeMode.END
        title_col.pack_start(render_text, True)
        title_col.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        title_col.add_attribute(render_text, "markup", 1)

        self.songs_treeview.append_column(title_col)

        self.songs_treeview.connect('button_press_event', self.on_treeview_button_press_event)

        self.stations_popover = StationsPopover()
        self.stations_popover.set_relative_to(self.stations_button)
        self.stations_popover.set_model(self.stations_model)
        self.stations_popover.listbox.connect('row-activated', self.active_station_changed)
        self.stations_button.set_popover(self.stations_popover)

        self.set_initial_pos()
Beispiel #17
0
    def __init__(self, version):
        super().__init__(application_id='com.rafaelmardojai.Blanket',
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(_('Blanket'))
        GLib.setenv('PULSE_PROP_application.icon_name',
                    'com.rafaelmardojai.Blanket-symbolic', True)
        # Connect app shutdown signal
        self.connect('shutdown', self._on_shutdown)

        # Add --hidden command line option
        self.add_main_option('hidden', b'h', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, 'Start window hidden', None)
        # App window
        self.window = None
        self.window_hidden = False
        # App version
        self.version = version
        # App main player
        self.mainplayer = MainPlayer()
        # Load saved props
        self.mainplayer.volume = Settings.get().volume
        self.mainplayer.playing = Settings.get().playing

        # Start MPRIS server
        self.mpris = MPRIS(self)
Beispiel #18
0
    def __init__(self, version):
        super().__init__(application_id='com.rafaelmardojai.Blanket',
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(_('Blanket'))
        GLib.set_prgname('com.rafaelmardojai.Blanket')
        GLib.setenv('PULSE_PROP_application.icon_name',
                    'com.rafaelmardojai.Blanket-symbolic', True)
        # Connect app shutdown signal
        self.connect('shutdown', self._on_shutdown)

        # Add --hidden command line option
        self.add_main_option('hidden', b'h', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, 'Start window hidden', None)
        # App window
        self.window = None
        self.window_hidden = False
        # App version
        self.version = version

        # Settings
        self.settings = Gio.Settings.new('com.rafaelmardojai.Blanket')
        self.sounds_settings = SoundsSettings(self.settings)
        # Saved playing state
        self.volume = self.settings.get_double('volume')
        self.playing = self.settings.get_boolean('playing')

        # App main player
        self.mainplayer = MainPlayer()
        # Load saved props
        self.mainplayer.set_property('volume', self.volume)
        self.mainplayer.set_property('playing', self.playing)

        # Start MPRIS server
        MPRIS(self)
Beispiel #19
0
def set_application_info(app):
    """Call after init() and before creating any windows to apply default
    values for names and icons.
    """

    from quodlibet._init import is_init

    assert is_init()

    from gi.repository import Gtk, GLib

    assert app.process_name
    set_process_title(app.process_name)
    # Issue 736 - set after main loop has started (gtk seems to reset it)
    GLib.idle_add(set_process_title, app.process_name)

    assert app.id
    # https://honk.sigxcpu.org/con/GTK__and_the_application_id.html
    GLib.set_prgname(app.id)
    assert app.name
    GLib.set_application_name(app.name)

    assert app.icon_name
    theme = Gtk.IconTheme.get_default()
    assert theme.has_icon(app.icon_name)
    Gtk.Window.set_default_icon_name(app.icon_name)
Beispiel #20
0
    def __init__(self):
        GLib.set_prgname('kickoff-player')
        GLib.set_application_name('Kickoff Player')

        add_custom_css('ui/styles.css')

        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('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.matches_loader = self.main.get_object('spinner_matches')
        self.channels_loader = self.main.get_object('spinner_channels')
        self.channels_stack = self.main.get_object('stack_channels')

        self.matches = MatchHandler(self)
        self.channels = ChannelHandler(self)
        self.player = PlayerHandler(self)
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.gnome.TwoFactorAuth",
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(_("TwoFactorAuth"))
        GLib.set_prgname("Gnome-TwoFactorAuth")

        self.menu = Gio.Menu()
        self.db = Database()
        self.cfg = SettingsReader()
        self.locked = self.cfg.read("state", "login")

        result = GK.unlock_sync("Gnome-TwoFactorAuth", None)
        if result == GK.Result.CANCELLED:
            self.quit()

        cssProviderFile = Gio.File.new_for_uri('resource:///org/gnome/TwoFactorAuth/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))
Beispiel #22
0
 def __init__(self):
     super().__init__(application_id='mlv.knrf.pastebinReader')
     GLib.set_application_name('Pastebin Reader')
     GLib.set_prgname('mlv.knrf.pastebinReader')
     self.backend  = App_Backend()
     self.cat_name = "javascript"
     self.lang_mang = GtkSource.LanguageManager()
Beispiel #23
0
    def __init__(self, version):
        super().__init__(application_id='com.rafaelmardojai.Blanket',
                         flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(_('Blanket'))
        GLib.setenv("PULSE_PROP_application.icon_name",
                    "com.rafaelmardojai.Blanket-symbolic", True)
        # App window
        self.window = None
        # App version
        self.version = version
        # GSettings
        self.gsettings = Gio.Settings.new('com.rafaelmardojai.Blanket')
        # App main player
        self.mainplayer = MainPlayer()
        # Connect mainplayer to volume function
        self.mainplayer.connect('notify::volume', self._on_volume_changed)

        # Get saved playing state
        self.playing = self.gsettings.get_boolean('playing')
        self.mainplayer.set_property('playing', self.playing)
        # Get saved volume
        self.saved_volume = self.gsettings.get_double('volume')
        self.mainplayer.set_property('volume', self.saved_volume)

        # Start MPRIS server
        MPRIS(self)
Beispiel #24
0
 def __init__(self):
     """
         Create application
     """
     Gtk.Application.__init__(
         self,
         application_id='org.gnome.Lollypop',
         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
     self.cursors = {}
     self.window = None
     self.notify = None
     self.mpd = None
     self.lastfm = None
     self.debug = False
     self._externals_count = 0
     self._init_proxy()
     GLib.set_application_name('lollypop')
     GLib.set_prgname('lollypop')
     # TODO: Remove this test later
     if Gtk.get_minor_version() > 12:
         self.add_main_option("debug", b'd', GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE, "Debug lollypop", None)
         self.add_main_option("set-rating", b'r', GLib.OptionFlags.NONE,
                              GLib.OptionArg.INT, "Rate the current track",
                              None)
         self.add_main_option("play-pause", b't', GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE, "Toggle playback", None)
         self.add_main_option("next", b'n', GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE, "Go to next track", None)
         self.add_main_option("prev", b'p', GLib.OptionFlags.NONE,
                              GLib.OptionArg.NONE, "Go to prev track", None)
     self.connect('command-line', self._on_command_line)
     self.register(None)
     if self.get_is_remote():
         Gdk.notify_startup_complete()
Beispiel #25
0
 def __init__(self, ratbagd_api_version):
     """Instantiates a new Application."""
     Gtk.Application.__init__(self,
                              application_id="org.freedesktop.Piper",
                              flags=Gio.ApplicationFlags.FLAGS_NONE)
     GLib.set_application_name("Piper")
     self._required_ratbagd_version = ratbagd_api_version
Beispiel #26
0
    def __init__(self, version):
        super().__init__(application_id='com.rafaelmardojai.Blanket',
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(_('Blanket'))
        GLib.set_prgname('com.rafaelmardojai.Blanket')
        GLib.setenv('PULSE_PROP_application.icon_name',
                    'com.rafaelmardojai.Blanket-symbolic', True)

        # Add --hidden command line option
        self.add_main_option('hidden', b'h', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, 'Start window hidden', None)
        # App window
        self.window = None
        self.window_hidden = False
        # App version
        self.version = version

        # GSettings
        self.gsettings = Gio.Settings.new('com.rafaelmardojai.Blanket')
        # Playing state
        self.playing = self.gsettings.get_boolean('playing')

        # App main player
        self.mainplayer = MainPlayer()
        # Bind mainplayer with settings
        self.gsettings.bind('volume', self.mainplayer, 'volume',
                            Gio.SettingsBindFlags.DEFAULT)
        self.gsettings.bind('playing', self.mainplayer, 'playing',
                            Gio.SettingsBindFlags.DEFAULT)

        # Start MPRIS server
        MPRIS(self)
Beispiel #27
0
def init(icon=None, proc_title=None, name=None):
    global quodlibet

    print_d("Entering quodlibet.init")

    _gtk_init()
    _gtk_icons_init(get_image_dir(), icon)
    _gst_init()
    _dbus_init()
    _init_debug()

    from gi.repository import GLib

    if proc_title:
        GLib.set_prgname(proc_title)
        set_process_title(proc_title)
        # Issue 736 - set after main loop has started (gtk seems to reset it)
        GLib.idle_add(set_process_title, proc_title)

    if name:
        GLib.set_application_name(name)

    mkdir(get_user_dir(), 0750)

    print_d("Finished initialization.")
Beispiel #28
0
    def __init__(self, version):
        super().__init__(application_id='io.github.seadve.Breathing',
                         flags=Gio.ApplicationFlags.FLAGS_NONE)

        self.version = version

        GLib.set_application_name("Breathing")
Beispiel #29
0
    def __init__(self, database: SqliteDatabase, view: MainView,
                 presenter: MainPresenter, builder: MainBuilder,
                 udev_interactor: UdevInteractor, *args: Any,
                 **kwargs: Any) -> None:
        LOG.debug("init Application")
        GLib.set_application_name(_(APP_NAME))
        super().__init__(*args,
                         application_id=APP_ID,
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
                         **kwargs)

        database.connect()
        database.create_tables(
            [SpeedProfile, SpeedStep, CurrentSpeedProfile, Setting])

        if SpeedProfile.select().count() == 0:
            load_db_default_data()

        self.add_main_option_entries(self._get_main_option_entries())
        self._view = view
        self._presenter = presenter
        self._presenter.application_quit = self.quit
        self._window: Optional[Gtk.ApplicationWindow] = None
        self._builder: Gtk.Builder = builder
        self._udev_interactor = udev_interactor
        self._start_hidden: bool = False
Beispiel #30
0
    def __init__(self):
        app_id = "com.github.schachmett.{}".format(__appname__.lower())
        super().__init__(application_id=app_id,
                         flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(__appname__)
        self.set_resource_base_path(str(DATA_DIR / "assets"))

        self.builder = Gtk.Builder.new()
        self.builder.add_from_file(str(DATA_DIR / "ui/gxps.glade"))
        self.builder.add_from_file(str(DATA_DIR / "ui/menus.ui"))
        self.get_widget = self.builder.get_object

        self.win = None
        self.bus = None
        self.commandsender = None
        self.data = None
        self.state = None
        self._view = None

        self.add_main_option_entries([
            make_option("--verbosity",
                        "-v",
                        arg=GLib.OptionArg.INT,
                        description="Value from 1 (only errors) to 4 (debug)"),
            make_option("--version", description="show program version"),
            make_option("--clean", description="don't load previous file")
        ])
Beispiel #31
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id="org.gnome.TwoFactorAuth",
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(_("TwoFactorAuth"))
        GLib.set_prgname("Gnome-TwoFactorAuth")

        self.menu = Gio.Menu()
        self.db = Database()
        self.cfg = SettingsReader()
        self.locked = self.cfg.read("state", "login")

        result = GK.unlock_sync("Gnome-TwoFactorAuth", None)
        if result == GK.Result.CANCELLED:
            self.quit()

        if Gtk.get_major_version() >= 3 and Gtk.get_minor_version() >= 20:
            cssFileName = "gnome-twofactorauth-post3.20.css"
        else:
            cssFileName = "gnome-twofactorauth-pre3.20.css"
        cssProviderFile = Gio.File.new_for_uri('resource:///org/gnome/TwoFactorAuth/%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))
Beispiel #32
0
    def __init__(self):

        Gtk.Application.__init__(
            self,
            application_id='net.lutris.Lutris',
            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)

        gettext.bindtextdomain("lutris", "/usr/share/locale")
        gettext.textdomain("lutris")

        check_config()
        migrate()
        update_platforms()

        GLib.set_application_name(_('Lutris'))
        self.window = None
        self.css_provider = Gtk.CssProvider.new()

        try:
            self.css_provider.load_from_path(
                os.path.join(datapath.get(), 'ui', 'lutris.css'))
        except GLib.Error as e:
            logger.exception(e)

        if hasattr(self, 'add_main_option'):
            self.add_arguments()
        else:
            ErrorDialog(
                "Your Linux distribution is too old, Lutris won't function properly"
            )
Beispiel #33
0
    def __init__(self):
        Gtk.Application.__init__(self, application_id='net.lutris.Lutris',
                                 flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        GLib.set_application_name(_('Lutris'))
        self.window = None

        self.add_main_option('debug',
                             ord('d'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('Show debug messages'),
                             None)
        self.add_main_option('install',
                             ord('i'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.STRING,
                             _('Install a game from a yml file'),
                             None)
        self.add_main_option('list-games',
                             ord('l'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('List all games in database'),
                             None)
        self.add_main_option('installed',
                             ord('o'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('Only list installed games'),
                             None)
        self.add_main_option('list-steam-games',
                             ord('s'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('List available Steam games'),
                             None)
        self.add_main_option('list-steam-folders',
                             0,
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('List all known Steam library folders'),
                             None)
        self.add_main_option('json',
                             ord('j'),
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('Display the list of games in JSON format'),
                             None)
        self.add_main_option('reinstall',
                             0,
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             _('Reinstall game'),
                             None)
        self.add_main_option(GLib.OPTION_REMAINING,
                             0,
                             GLib.OptionFlags.NONE,
                             GLib.OptionArg.STRING_ARRAY,
                             _('uri to open'),
                             'URI')
Beispiel #34
0
	def __init__(self):
		Gtk.Application.__init__(self,
					 application_id='org.gnome.Lollypop',
					 flags=Gio.ApplicationFlags.FLAGS_NONE)
		GLib.set_application_name('lollypop')
		GLib.set_prgname('lollypop')
		cssProviderFile = Gio.File.new_for_uri('resource:///org/gnome/Lollypop/application.css')
		cssProvider = Gtk.CssProvider()
		cssProvider.load_from_file(cssProviderFile)
		screen = Gdk.Screen.get_default()
		styleContext = Gtk.StyleContext()
		styleContext.add_provider_for_screen(screen, cssProvider,
						     Gtk.STYLE_PROVIDER_PRIORITY_USER)

		Objects["settings"] = Gio.Settings.new('org.gnome.Lollypop')
		Objects["db"] = Database()
		# We store a cursor for the main thread
		Objects["sql"] = Objects["db"].get_cursor()
		Objects["albums"] = DatabaseAlbums()
		Objects["artists"] = DatabaseArtists()
		Objects["genres"] = DatabaseGenres()
		Objects["tracks"] = DatabaseTracks()	
		Objects["player"] = Player()
		Objects["art"] = AlbumArt()

		self._window = None

		self.register()
		if self.get_is_remote():
			Gdk.notify_startup_complete()
Beispiel #35
0
def main():
    GLib.set_application_name('demo.py')
    GLib.set_prgname('demo.py')
    app = Gw.Application.new()
    app.connect('activate', on_activate)
    exit_code = app.run(sys.argv)
    sys.exit(exit_code)
Beispiel #36
0
 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
Beispiel #37
0
    def __init__(self):
        GLib.set_application_name('pympress')
        Gtk.Application.__init__(self,
                                 application_id='io.github.pympress',
                                 flags=Gio.ApplicationFlags.HANDLES_OPEN
                                 | Gio.ApplicationFlags.CAN_OVERRIDE_APP_ID)

        self.register(None)

        if not self.get_is_remote():
            builder.Builder.setup_actions(
                {
                    'log-level':
                    dict(activate=self.set_log_level,
                         state=logger.getEffectiveLevel(),
                         parameter_type=int),
                },
                action_map=self)

        # Connect proper exit function to interrupt
        signal.signal(signal.SIGINT, self.quit)

        for opt in self.options:
            self.add_main_option(
                opt, *self.options[opt],
                *self.option_descriptions.get(opt, ['', None]))
Beispiel #38
0
    def init_ui(self):
        GLib.set_application_name("Pithos")
        Gtk.Window.set_default_icon_name('pithos')
        os.environ['PULSE_PROP_media.role'] = 'music'

        self.volume.set_relief(Gtk.ReliefStyle.NORMAL)  # It ignores glade...
        self.settings.bind('volume', self.volume, 'value', Gio.SettingsBindFlags.DEFAULT)

        self.songs_treeview.set_model(self.songs_model)

        title_col   = Gtk.TreeViewColumn()

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, False)
        title_col.add_attribute(render_icon, "icon", 2)
        title_col.add_attribute(render_icon, "pixbuf", 3)

        render_text = Gtk.CellRendererText(xpad=TEXT_X_PADDING)
        render_text.props.ellipsize = Pango.EllipsizeMode.END
        title_col.pack_start(render_text, True)
        title_col.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        title_col.add_attribute(render_text, "markup", 1)

        self.songs_treeview.append_column(title_col)

        self.songs_treeview.connect('button_press_event', self.on_treeview_button_press_event)

        self.stations_popover = StationsPopover()
        self.stations_popover.set_relative_to(self.stations_button)
        self.stations_popover.set_model(self.stations_model)
        self.stations_popover.listbox.connect('row-activated', self.active_station_changed)
        self.stations_button.set_popover(self.stations_popover)

        self.set_initial_pos()
Beispiel #39
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.Lollypop',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name('lollypop')
        GLib.set_prgname('lollypop')
        self.set_flags(Gio.ApplicationFlags.HANDLES_OPEN)
        self.connect('open', self._on_files_opened)
        cssProviderFile = Gio.File.new_for_uri(
                            'resource:///org/gnome/Lollypop/application.css'
                                              )
        cssProvider = Gtk.CssProvider()
        cssProvider.load_from_file(cssProviderFile)
        screen = Gdk.Screen.get_default()
        monitor = screen.get_primary_monitor()
        geometry = screen.get_monitor_geometry(monitor)
        # We want 500 and 200 in full hd
        ArtSize.BIG = int(200*geometry.width/1920)
        ArtSize.MONSTER = int(500*geometry.width/1920)

        styleContext = Gtk.StyleContext()
        styleContext.add_provider_for_screen(screen, cssProvider,
                                             Gtk.STYLE_PROVIDER_PRIORITY_USER)

        Objects.settings = Gio.Settings.new('org.gnome.Lollypop')
        Objects.db = Database()
        # We store a cursor for the main thread
        Objects.sql = Objects.db.get_cursor()
        Objects.player = Player()
        Objects.albums = DatabaseAlbums()
        Objects.artists = DatabaseArtists()
        Objects.genres = DatabaseGenres()
        Objects.tracks = DatabaseTracks()
        Objects.playlists = PlaylistsManager()
        Objects.art = AlbumArt()

        settings = Gtk.Settings.get_default()
        dark = Objects.settings.get_value('dark-ui')
        settings.set_property("gtk-application-prefer-dark-theme", dark)

        self._parser = TotemPlParser.Parser.new()
        self._parser.connect("entry-parsed", self._on_entry_parsed)
        self._parser.connect("playlist-ended", self._on_playlist_ended)
        self._parsing = 0

        self.add_action(Objects.settings.create_action('shuffle'))
        self._window = None
        self._opened_files = False
        self._external_files = []

        DESKTOP = environ.get("XDG_CURRENT_DESKTOP")
        if DESKTOP and "GNOME" in DESKTOP:
            self._appmenu = True
        else:
            self._appmenu = False

        self.register(None)
        if self.get_is_remote():
            Gdk.notify_startup_complete()
Beispiel #40
0
    def __init__(self):
        super().__init__(
            application_id='org.gtk.' + app_info.NAME,
            flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name(app_info.TITLE)
        GLib.set_prgname(app_info.NAME)

        self._window = None
Beispiel #41
0
 def __init__(self):
     super().__init__(
       application_id=meld.conf.APPLICATION_ID,
       flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE,
     )
     GLib.set_application_name("Meld")
     GLib.set_prgname(meld.conf.APPLICATION_ID)
     Gtk.Window.set_default_icon_name("org.gnome.meld")
Beispiel #42
0
 def __init__(self):
     Gtk.Application.__init__(self,
                              application_id='today.sam.reddit-is-gtk')
     self.connect('startup', self.__do_startup_cb)
     GLib.set_application_name("Something For Reddit")
     GLib.set_prgname("reddit-is-gtk")
     self._w = None
     self._queue_uri = None
Beispiel #43
0
    def __init__(self):
        Gtk.Application.__init__(self, application_id='com.calindora.jeff')
        Gst.init()

        GLib.set_application_name('Jeff')

        self.connect('activate', self.on_activate)
        self.connect('startup', self.on_startup)
Beispiel #44
0
    def init_ui(self):
        GLib.set_application_name("Pithos")
        Gtk.Window.set_default_icon_name("pithos")
        os.environ["PULSE_PROP_media.role"] = "music"

        self.playpause_button = self.builder.get_object("playpause_button")

        self.volume = self.builder.get_object("volume")
        self.volume.set_property("value", math.pow(float(self.preferences["volume"]), 1.0 / 3.0))

        self.statusbar = self.builder.get_object("statusbar1")

        self.song_menu = self.builder.get_object("song_menu")
        self.song_menu_love = self.builder.get_object("menuitem_love")
        self.song_menu_unlove = self.builder.get_object("menuitem_unlove")
        self.song_menu_ban = self.builder.get_object("menuitem_ban")
        self.song_menu_unban = self.builder.get_object("menuitem_unban")

        self.songs_treeview = self.builder.get_object("songs_treeview")
        self.songs_treeview.set_model(self.songs_model)

        self.pos_label = self.builder.get_object("pos_label")
        self.dur_label = self.builder.get_object("dur_label")
        self.progressbar = self.builder.get_object("progressbar")

        title_col = Gtk.TreeViewColumn()

        def bgcolor_data_func(column, cell, model, iter, data=None):
            if model.get_value(iter, 0) is self.current_song:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.ACTIVE)
            else:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.NORMAL)
            cell.set_property("cell-background-rgba", bgcolor)

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, False)
        title_col.add_attribute(render_icon, "icon", 2)
        title_col.add_attribute(render_icon, "pixbuf", 3)
        title_col.set_cell_data_func(render_icon, bgcolor_data_func)

        render_text = Gtk.CellRendererText()
        render_text.props.ellipsize = Pango.EllipsizeMode.END
        title_col.pack_start(render_text, True)
        title_col.add_attribute(render_text, "markup", 1)
        title_col.set_cell_data_func(render_text, bgcolor_data_func)

        self.songs_treeview.append_column(title_col)

        self.songs_treeview.connect("button_press_event", self.on_treeview_button_press_event)

        self.stations_combo = self.builder.get_object("stations")
        self.stations_combo.set_model(self.stations_model)
        render_text = Gtk.CellRendererText()
        self.stations_combo.pack_start(render_text, True)
        self.stations_combo.add_attribute(render_text, "text", 1)
        self.stations_combo.set_row_separator_func(
            lambda model, iter, data=None: model.get_value(iter, 0) is None, None
        )
Beispiel #45
0
    def __init__(self):
        """
            Create application
        """
        Gtk.Application.__init__(
                            self,
                            application_id='org.gnome.Lollypop',
                            flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE)
        self.set_property('register-session', True)
        GLib.setenv('PULSE_PROP_media.role', 'music', True)
        GLib.setenv('PULSE_PROP_application.icon_name', 'lollypop', True)

        # Ideally, we will be able to delete this once Flatpak has a solution
        # for SSL certificate management inside of applications.
        if GLib.file_test("/app", GLib.FileTest.EXISTS):
            paths = ["/etc/ssl/certs/ca-certificates.crt",
                     "/etc/pki/tls/cert.pem",
                     "/etc/ssl/cert.pem"]
            for path in paths:
                if GLib.file_test(path, GLib.FileTest.EXISTS):
                    GLib.setenv('SSL_CERT_FILE', path, True)
                    break

        self.cursors = {}
        self.window = None
        self.notify = None
        self.lastfm = None
        self.debug = False
        self.__externals_count = 0
        self.__init_proxy()
        GLib.set_application_name('Lollypop')
        GLib.set_prgname('lollypop')
        self.add_main_option("play-ids", b'a', GLib.OptionFlags.NONE,
                             GLib.OptionArg.STRING, "Play ids", None)
        self.add_main_option("debug", b'd', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, "Debug lollypop", None)
        self.add_main_option("set-rating", b'r', GLib.OptionFlags.NONE,
                             GLib.OptionArg.INT, "Rate the current track",
                             None)
        self.add_main_option("play-pause", b't', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, "Toggle playback",
                             None)
        self.add_main_option("next", b'n', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, "Go to next track",
                             None)
        self.add_main_option("prev", b'p', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, "Go to prev track",
                             None)
        self.add_main_option("emulate-phone", b'e', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE,
                             "Emulate an Android Phone",
                             None)
        self.connect('command-line', self.__on_command_line)
        self.connect('activate', self.__on_activate)
        self.register(None)
        if self.get_is_remote():
            Gdk.notify_startup_complete()
        self.__listen_to_gnome_sm()
Beispiel #46
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.Lollypop',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name('lollypop')
        GLib.set_prgname('lollypop')
        self.set_flags(Gio.ApplicationFlags.HANDLES_OPEN)
        self.add_main_option("debug", b'd', GLib.OptionFlags.NONE,
                             GLib.OptionArg.NONE, "Debug lollypop", None)
        self.connect('handle-local-options', self._on_handle_local_options)
        cssProviderFile = Gio.File.new_for_uri(
            'resource:///org/gnome/Lollypop/application.css')
        cssProvider = Gtk.CssProvider()
        cssProvider.load_from_file(cssProviderFile)
        screen = Gdk.Screen.get_default()
        monitor = screen.get_primary_monitor()
        geometry = screen.get_monitor_geometry(monitor)
        # We want 500 and 200 in full hd
        ArtSize.BIG = int(200*geometry.width/1920)
        ArtSize.MONSTER = int(500*geometry.width/1920)

        styleContext = Gtk.StyleContext()
        styleContext.add_provider_for_screen(screen, cssProvider,
                                             Gtk.STYLE_PROVIDER_PRIORITY_USER)
        if PYLAST:
            Lp.lastfm = LastFM()
        Lp.settings = Settings.new()
        Lp.db = Database()
        # We store a cursor for the main thread
        Lp.sql = Lp.db.get_cursor()
        Lp.player = Player()
        Lp.albums = AlbumsDatabase()
        Lp.artists = ArtistsDatabase()
        Lp.genres = GenresDatabase()
        Lp.tracks = TracksDatabase()
        Lp.playlists = PlaylistsManager()
        Lp.scanner = CollectionScanner()
        Lp.art = Art()
        if not Lp.settings.get_value('disable-mpris'):
            MPRIS(self)
        if not Lp.settings.get_value('disable-notifications'):
            Lp.notify = NotificationManager()

        settings = Gtk.Settings.get_default()
        dark = Lp.settings.get_value('dark-ui')
        settings.set_property("gtk-application-prefer-dark-theme", dark)

        self._parser = TotemPlParser.Parser.new()
        self._parser.connect("entry-parsed", self._on_entry_parsed)

        self.add_action(Lp.settings.create_action('shuffle'))
        self._externals_count = 0
        self._is_fs = False

        self.register(None)
        if self.get_is_remote():
            Gdk.notify_startup_complete()
Beispiel #47
0
 def __init__(self, *args, **kwargs):
     GLib.set_application_name(_("Extensions Manager debugger"))
     super().__init__(*args,
                      application_id=APPLICATION_ID,
                      flags=Gio.ApplicationFlags.FLAGS_NONE,
                      **kwargs)
     self.application = Gtk.Application()
     self.application.connect("activate", self.do_activate)
     self.application.connect("startup", self.do_startup)
Beispiel #48
0
 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)
def main(argv):
    Gtk.init()
    GLib.set_prgname(PRGNAME)
    GLib.set_application_name(PRGTITLE)
    indicator = ModeIndicator()
    indicator.build_menu()

    Gtk.main()
    return 0
Beispiel #50
0
    def init_ui(self):
        GLib.set_application_name("Pithos")
        Gtk.Window.set_default_icon_name('pithos')
        os.environ['PULSE_PROP_media.role'] = 'music'

        self.playpause_image = self.builder.get_object('playpause_image')

        self.volume = self.builder.get_object('volume')
        self.volume.set_relief(Gtk.ReliefStyle.NORMAL)  # It ignores glade...
        self.volume.set_property("value", math.pow(float(self.preferences['volume']), 1.0/3.0))

        self.statusbar = self.builder.get_object('statusbar1')

        self.song_menu = self.builder.get_object('song_menu')
        self.song_menu_love = self.builder.get_object('menuitem_love')
        self.song_menu_unlove = self.builder.get_object('menuitem_unlove')
        self.song_menu_ban = self.builder.get_object('menuitem_ban')
        self.song_menu_unban = self.builder.get_object('menuitem_unban')

        self.songs_treeview = self.builder.get_object('songs_treeview')
        self.songs_treeview.set_model(self.songs_model)

        title_col   = Gtk.TreeViewColumn()

        def bgcolor_data_func(column, cell, model, iter, data=None):
            if model.get_value(iter, 0) is self.current_song:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.ACTIVE)
            else:
                bgcolor = column.get_tree_view().get_style_context().get_background_color(Gtk.StateFlags.NORMAL)
            cell.set_property("cell-background-rgba", bgcolor)

        render_icon = CellRendererAlbumArt()
        title_col.pack_start(render_icon, False)
        title_col.add_attribute(render_icon, "icon", 2)
        title_col.add_attribute(render_icon, "pixbuf", 3)
        title_col.set_cell_data_func(render_icon, bgcolor_data_func)

        render_text = Gtk.CellRendererText()
        render_text.props.ellipsize = Pango.EllipsizeMode.END
        title_col.pack_start(render_text, True)
        title_col.set_sizing(Gtk.TreeViewColumnSizing.FIXED)
        title_col.add_attribute(render_text, "markup", 1)
        title_col.set_cell_data_func(render_text, bgcolor_data_func)

        self.songs_treeview.append_column(title_col)

        self.songs_treeview.connect('button_press_event', self.on_treeview_button_press_event)

        self.stations_button = self.builder.get_object('stations')
        self.stations_popover = StationsPopover()
        self.stations_popover.set_relative_to(self.stations_button)
        self.stations_popover.set_model(self.stations_model)
        self.stations_popover.listbox.connect('row-activated', self.active_station_changed)
        self.stations_button.set_popover(self.stations_popover)
        self.stations_label = self.builder.get_object('stationslabel')

        self.set_initial_pos()
Beispiel #51
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.Tattoo',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name("Tattoo")
        GLib.set_prgname('Tattoo')
        # self.settings = Gio.Settings.new('org.gnome.Tattoo')

        self._window = None
Beispiel #52
0
	def __init__(self):
		Gtk.Application.__init__(self,
			application_id="app.qrencode-gtk",
			flags=Gio.ApplicationFlags.FLAGS_NONE)
		
		GLib.set_application_name("QR code") # ?
		
		Gdk.threads_init()
        	
		self.connect("shutdown", self.handle_action_quit, None)
 def __init__(self, ic: IdentityController, api_factory: APIFactory):
     Gtk.Application.__init__(self,
                              application_id='today.sam.reddit-is-gtk')
     self.connect('startup', self.__do_startup_cb)
     GLib.set_application_name("Something For Reddit")
     GLib.set_prgname("reddit-is-gtk")
     self._w = None
     self._queue_uri = None
     self._ic = ic
     self._api_factory = api_factory
    def __init__(self):
        Gtk.Application.__init__(
            self, application_id="org.gnome.Usage", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE
        )
        GLib.set_application_name(_("Usage"))
        GLib.set_prgname("usage")

        self._add_command_line_options()

        self._window = None
Beispiel #55
0
 def __init__(self, *args, **kwargs):
     """
     Missing method docstring (missing-docstring)
     """
     super().__init__(application_id="net.t00mlabs.basico", flags=Gio.ApplicationFlags.FLAGS_NONE)
     GLib.set_application_name("Basico")
     GLib.set_prgname('basico')
     self.log = get_logger(__class__.__name__)
     self.app = args[0]
     self.get_services()
Beispiel #56
0
def main():
    GLib.set_application_name('GNOME password generator')
    master_key = get_master_key()
    if not master_key:
        master_pw = raw_input('need to generate master key:')
        master_key = gpwg.generate_master_key(master_pw)
        insert_master_key(master_pw)
        print 'saved master key to gnome keyring'
    s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
    s.connect(SOCKET_PATH)
    s.send(master_key)
Beispiel #57
0
    def __init__(self):
        Gtk.Application.__init__(self,
                                 application_id='org.gnome.Reader',
                                 flags=Gio.ApplicationFlags.FLAGS_NONE)
        GLib.set_application_name('Reader')
        GLib.set_prgname('gnome-reader')

        # TODO : create config schema
        # self.settings = Gio.Settings.new('org.gnome.Reader')

        self._window = None
Beispiel #58
0
 def __init__(self):
     Gtk.Application.__init__(self)
     GLib.set_application_name(self.APP_NAME)
     self.win = None
     self.settings = None
     self.discoverer = None
     self.player = None
     self.equalizer = None
     self.queue = None
     self.history = None
     self.integration = None