def __init__(self, version): """ Create application @param version as str """ Gtk.Application.__init__( self, application_id="org.gnome.Lollypop", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) self.__version = version self.set_property("register-session", True) GLib.setenv("PULSE_PROP_media.role", "music", True) GLib.setenv("PULSE_PROP_application.icon_name", "org.gnome.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.add_main_option("version", b"V", GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Lollypop version", 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()
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
def main(): path = os.path.abspath(os.path.dirname(__file__)) # Load desmume emu = DeSmuME() # Init joysticks emu.input.joy_init() # Load Builder and Window builder = Gtk.Builder() builder.add_from_file(os.path.join(path, "PyDeSmuMe.glade")) main_window: Window = builder.get_object("wMainW") main_window.set_role("PyDeSmuME") GLib.set_application_name("PyDeSmuME") GLib.set_prgname("pydesmume") # TODO: Deprecated but the only way to set the app title on GNOME...? main_window.set_wmclass("PyDeSmuME", "PyDeSmuME") # Load main window + controller MainController(builder, main_window, emu) main_window.present() Gtk.main() del emu
def __init__ (self): """ Init Application """ Gtk.Application.__init__(self) self.new(PRGM_NAME, Gio.ApplicationFlags.FLAGS_NONE) GLib.set_prgname(PRGM_NAME) GLib.set_application_name(PRGM_HNAME) # load CSS cssProvider = Gtk.CssProvider() cssProvider.load_from_resource(PRGM_PATH + 'css/style.css') Gtk.StyleContext().add_provider_for_screen( Gdk.Screen.get_default(), cssProvider, Gtk.STYLE_PROVIDER_PRIORITY_USER) self.currencies = {} # add USD currency self.currencies['USD'] = Currency('Dollars', 'USD', None) self.currencies['USD'].priceUSD = 1 self.currencies['USD'].lastDayPriceUSD = 1 self.currencies['USD'].athUSD = (1, None) self.currencies['USD'].rank = 0 # add digital assets for cur in currencies.getCurrencies(): currency = Currency(cur[0], cur[1], cur[2]) self.currencies[currency.symbol] = currency self.__settings = Settings() self.__settings.loadLastCurrenciesRank(self.currencies) self.__settings.loadFavoriteCurrencies(self.currencies) self.__mainWindow = Window(self)
def __init__(self): Gtk.Application.__init__(self) GLib.set_application_name('LLVM Browse') GLib.set_prgname('llvm-browse') self.argv: argparse.Namespace = None self.options: Options = Options(self) self.ui: UI = UI(self) # The user has to explicitly set a mark. When one is set, prev-use # and next-use will be enabled and the user can navigate this list self.marks: List[Tuple[int, int]] = [] # A map from entities to uses. The keys are all guaranteed to be in # self.marks self.uses_map: Mapping[int, List[int]] = {} # Map from the entities with marks set to the index of the use that # was last jumped to using prev-us or next-use. Because the same # entity can be marked more than once, the value is a list self.uses_indexes_map: Mapping[int, List[int]] = {} self.connect('notify::entity', self.on_entity_changed) self.connect('notify::inst', self.on_instruction_changed) self.connect('notify::func', self.on_function_changed)
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
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)
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.")
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()
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))
def __init__(self): Gtk.Application.__init__(self, flags=Gio.ApplicationFlags.FLAGS_NONE) GLib.set_prgname('Winder') self.windings = 0 self.achieved_windings = 0 self.position = 0 self.positions = [] self.previous_move_right = 0 self.connect("activate", self._on_activate) self.offset_pos = 0 self.offset_rot = 0 self.moveset = [] self.cont = False self.sent_windings = 0 self.move_setting = 0 self.buffer_size = 10 self.on_start_clicked = False self.counter = 0 self.prev = time.time() self.grbl = serial.Serial(loc, baudrate) time.sleep(5) self.grbl.read(self.grbl.inWaiting()) self.grbl.write("$X\n") self.grbl.readline() self.grbl.write("?\n") self.grbl.readline() self.grbl.write("?\n") self.grbl.readline() GPIO.setmode(GPIO.BCM) GPIO.setup(end_switch_channel, GPIO.IN) GPIO.setup(panic_channel, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) GPIO.add_event_detect(end_switch_channel, GPIO.FALLING, callback=self.end_switch_cb, bouncetime=400) GPIO.add_event_detect(panic_channel, GPIO.RISING, callback=self.panic_cb, bouncetime=400)
def __init__(self): """Init function.""" super(KaedeApplication, self).__init__() self.app_window = None self.set_application_id("dev.hattshire.kaede") GLib.set_prgname(self.props.application_id) GLib.set_application_name("Kaede")
def __init__(self, args=None): self._glib_context = None self._glib_loop = None self._glib_thread = None self._sink_string = None self._sink = None self._pipeline = None self._filesrc = None logger.debug("GStreamerAudioDriver.__init__(args=%r)", args) PositionPollingAudioDriver.__init__(self, args) # initialize GLib application name if not reasonably initialized yet # this will be used as client name in Jack and PulseAudio sinks prgname = GLib.get_prgname() if not prgname or 'python' in prgname.lower(): prgname = "sampledrawer" GLib.set_prgname(prgname) appname = GLib.get_application_name() if not appname or appname == prgname or 'python' in appname.lower(): GLib.set_application_name("Sample Drawer") try: Gst.init(None) except GLib.Error as err: raise AudioDriverError( "Cannot initialize GStreamer: {}".format(err)) self._init_glib_loop() self._init_sink(args) self._rewind()
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)
def __init__(self, version='', *args, **kwargs): super().__init__( *args, application_id='space.autre.stroked', flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE, **kwargs ) GLib.set_application_name('Stroked') GLib.set_prgname('space.autre.stroked') self._init_style() self._init_menubar() self.version = version self.settings = Gio.Settings.new('space.autre.stroked') # Command line arguments definitions self.add_main_option( 'output', ord('o'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, 'Export destination', 'FOLDER', ) self.add_main_option( 'format', ord('f'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, 'Export format, choose from [ufo, otf, tff]', 'FORMAT', )
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')
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()
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')
def __init__(self, application_id): super().__init__(application_id=application_id, flags=Gio.ApplicationFlags.FLAGS_NONE) self.props.resource_base_path = "/org/gnome/Music" GLib.set_application_name(_("Music")) GLib.set_prgname(application_id) GLib.setenv("PULSE_PROP_media.role", "music", True) self._init_style() self._window = None self._log = MusicLogger() self._search = Search() self._notificationmanager = NotificationManager(self) self._coreselection = CoreSelection() self._coremodel = CoreModel(self) # Order is important: CoreGrilo initializes the Grilo sources, # which in turn use CoreModel & CoreSelection extensively. self._coregrilo = CoreGrilo(self) self._settings = Gio.Settings.new('org.gnome.Music') self._lastfm_scrobbler = LastFmScrobbler(self) self._player = Player(self) InhibitSuspend(self) PauseOnSuspend(self._player)
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()
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)
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)
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))
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()
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()
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()
def __init__(self, version, extension_dir): """ Create application @param version as str @param extension_dir as str """ self.__version = version self.__state_cache = [] # First check WebKit2 version if WebKit2.MINOR_VERSION < 18: exit("You need WebKit2GTK >= 2.18") Gtk.Application.__init__( self, application_id="org.gnome.Eolie", flags=Gio.ApplicationFlags.HANDLES_COMMAND_LINE) self.set_property("register-session", True) # Fix proxy for python proxy = GLib.environ_getenv(GLib.get_environ(), "all_proxy") if proxy is not None and proxy.startswith("socks://"): proxy = proxy.replace("socks://", "socks4://") from os import environ environ["all_proxy"] = proxy environ["ALL_PROXY"] = proxy # 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.sync_worker = None # Not initialised self.__extension_dir = extension_dir self.debug = False self.show_tls = False self.cursors = {} GLib.set_application_name('Eolie') GLib.set_prgname('org.gnome.Eolie') self.add_main_option("debug", b'd', GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Debug Eolie", None) self.add_main_option("private", b'p', GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Add a private page", None) self.add_main_option("new", b'n', GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Add a new window", None) self.add_main_option("disable-artwork-cache", b'a', GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Do not use cache for art", None) self.add_main_option("show-tls", b's', GLib.OptionFlags.NONE, GLib.OptionArg.NONE, "Show TLS info", None) self.connect('activate', self.__on_activate) self.connect("handle-local-options", self.__on_handle_local_options) self.connect('command-line', self.__on_command_line) self.register(None) if self.get_is_remote(): Gdk.notify_startup_complete() self.__listen_to_gnome_sm()
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()
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
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("meld")
def __init__(self, version): super().__init__(application_id=Constants.APPID, flags=Gio.ApplicationFlags.FLAGS_NONE) self.version = version GLib.set_application_name("Meowgram") GLib.set_prgname(Constants.APPID)
def __init__(self, version): super().__init__(application_id='io.github.seadve.Kooha', flags=Gio.ApplicationFlags.FLAGS_NONE) self.version = version GLib.set_application_name("Kooha") GLib.set_prgname('io.github.seadve.Kooha')
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")
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
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()
def main(argv): Gtk.init() GLib.set_prgname(PRGNAME) GLib.set_application_name(PRGTITLE) indicator = ModeIndicator() indicator.build_menu() Gtk.main() return 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 __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()
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
def main(paths): global app # Needed to see application icon on Wayland, while we don't yet # use the reverse domain application ID with Gtk.Application. # https://wiki.gnome.org/Projects/GnomeShell/ApplicationBased # https://github.com/otsaloma/gaupol/issues/62 GLib.set_prgname("nfoview") i18n.bind() app = Application(paths) raise SystemExit(app.run())
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()
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
def main(args=None): GObject.threads_init() if not args: args = sys.argv[1:] parser = optparse.OptionParser() parser.add_option("-i", "--interval", dest="interval", default=60, type=int, help="scraping interval in seconds") parser.add_option("-o", "--output", dest="output", default="", help="output filename. Should be a path to a mp3 file") parser.add_option("-s", "--station", dest="station", default="FIP", help="Radio to tune to.") parser.add_option("-a", "--audio-sink", dest="audiosink", default="autoaudiosink", help="audio sink to use") parser.add_option("-n", "--no-scrobble", action="store_true", default=False, dest="noscrobble", help="disable scrobbling") parser.add_option("-l", "--list-stations", action="store_true", default=False, dest="list_stations", help="display the list of radio stations") parser.add_option("-x", "--headless", action="store_true", default=False, dest="headless", help="disable desktop notifications") (options, args) = parser.parse_args(args) if options.list_stations: from radioplayer.radios import STATIONS print "Supported radio stations:" stations = STATIONS.keys() stations.sort() for name in stations: print "- %s" % name return 0 if args: cfgfile = args[0] else: cfgfile = os.path.expanduser("~/.config/radioplayer.cfg") config = ConfigParser.RawConfigParser() if os.path.exists(cfgfile): config.read(cfgfile) GLib.set_prgname("RadioPlayer") GLib.setenv("PA_PROP_MEDIA_ROLE", "music", True) GLib.setenv("PA_PROP_MEDIA_ICON_NAME", "audio-x-mp3", True) from radioplayer.notifier import Notifier notifier = Notifier(options, config) notifier.run()
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
def main(args): """Initialize application.""" global appman # Needed to see application icon on Wayland, while we don't yet # use the reverse domain application ID with Gtk.Application. # https://wiki.gnome.org/Projects/GnomeShell/ApplicationBased # https://github.com/otsaloma/gaupol/issues/62 GLib.set_prgname("gaupol") aeidon.i18n.bind() appman = ApplicationManager(args) raise SystemExit(appman.run())
def main(): parser.parse_args() signal.signal(signal.SIGINT, signal.SIG_DFL) GLib.set_application_name("RunSQLRun") GLib.set_prgname("runsqlrun") resource = Gio.resource_load("data/runsqlrun.gresource") Gio.Resource._register(resource) app = Application() sys.exit(app.run(sys.argv))
def __init__(self, package, version): self.package = package self.version = version super(Application, self).__init__( application_id='com.yourtime.{}'.format(package), flags=Gio.ApplicationFlags.FLAGS_NONE ) GLib.set_application_name(_("YourTime Tool")) GLib.set_prgname('yt_gtk')
def __init__(self): Gtk.Application.__init__(self, application_id="org.gnome.Music", flags=Gio.ApplicationFlags.FLAGS_NONE) GLib.set_application_name(_("Music")) GLib.set_prgname("gnome-music") self.settings = Gio.Settings.new("org.gnome.Music") cssProviderFile = Gio.File.new_for_uri("resource:///org/gnome/Music/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) self._window = None
def __init__(self): Gtk.Application.__init__(self, application_id=config.RESOURCE_NAME, flags=Gio.ApplicationFlags.FLAGS_NONE) # Set application name GLib.set_application_name(config.APP_NAME) GLib.set_prgname(config.EXEC_NAME) # add stylesheet add_stylesheet("main.css") # window self._window = None
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), ]
def __init__(self): Gtk.Application.__init__( self, application_id='net.launchpad.choral', flags=Gio.ApplicationFlags.FLAGS_NONE) Gdk.set_program_class('choral') GLib.set_prgname('choral') with open(os.path.join(settings.BASE_DIR, 'assets/css/gtk-ui.css'), 'r') as f: stylesheet = f.read().encode('UTF-8') self.set_theming(stylesheet, 'choral') self._mime = magic.open(magic.MAGIC_MIME) self._mime.load()
def __init__(self, **kwargs): super().__init__(application_id='se.tingping.Trg', flags=Gio.ApplicationFlags.HANDLES_OPEN, **kwargs) if GLib.get_prgname() == '__main__.py': GLib.set_prgname('transmission-remote-gnome') self.window = None self.client = None self.download_monitor = None self.status = None self.settings = Gio.Settings.new('se.tingping.Trg') self.add_main_option('log', 0, GLib.OptionFlags.NONE, GLib.OptionArg.INT, _('Set log level'), None)
def __init__(self, datadir): Gtk.Application.__init__(self, application_id='com.cognisian.gudalife', flags=Gio.ApplicationFlags.FLAGS_NONE) GLib.set_application_name('GudaLife') GLib.set_prgname('gudalife') self._window = None self._window_handler = None self._datadir = datadir self.builder = None self.settings = None self.board = None self.draw_state = True
def __init__(self): Gtk.Application.__init__(self, application_id='org.gstreamer.Earthquake', flags=Gio.ApplicationFlags.FLAGS_NONE) GLib.set_application_name("Earthquake") GLib.set_prgname('earthquake') cssProviderFile = Gio.File.new_for_uri( 'resource:///org/gstreamer/Earthquake/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) self._window = None
def __init__(self): Gtk.Application.__init__(self, application_id="org.me.tarrab.Checker", flags=Gio.ApplicationFlags.FLAGS_NONE) self.setting_schema_source = None self.settings = None self.connect('activate', self.activate_cb) self.connect('startup', self.startup_cb) GLib.set_application_name("Tarrab.me Checker") GLib.set_prgname('tarrabme_checker_gtk-Checker') self.register(None) if self.get_is_remote(): print("Application already running") self.quit()