def load(self, use_trayicon=None): if Gtk.get_major_version() == 4: return if sys.platform == "darwin": # Tray icons don't work as expected on macOS return if sys.platform == "win32": # Always keep tray icon loaded for notification support pass elif use_trayicon is None: if not config.sections["ui"]["trayicon"]: return elif not use_trayicon: return if self.tray_icon is None: if self.appindicator is not None: tray_icon = self.appindicator.Indicator.new( GLib.get_application_name(), "", self.appindicator.IndicatorCategory.APPLICATION_STATUS) tray_icon.set_menu(self.tray_popup_menu) # Action to hide/unhide main window when middle clicking the tray icon tray_icon.set_secondary_activate_target(self.hide_show_item) # If custom icon path was found, use it, otherwise we fall back to system icons self.final_icon_path = self.get_final_icon_path() if self.final_icon_path: tray_icon.set_icon_theme_path(self.final_icon_path) else: # GtkStatusIcon fallback tray_icon = self.gtk.StatusIcon() tray_icon.set_tooltip_text(GLib.get_application_name()) tray_icon.connect("activate", self.on_hide_unhide_window) tray_icon.connect("popup-menu", self.on_status_icon_popup) self.tray_icon = tray_icon self.set_alternative_speed_limit( config.sections["transfers"]["usealtlimits"]) if use_trayicon or config.sections["ui"]["trayicon"]: self.show() self.set_image(self.tray_status["status"]) return self.set_image("msg") self.hide()
def new_text_notification(self, message, title=None, priority=Gio.NotificationPriority.NORMAL): if title is None: title = GLib.get_application_name() try: if sys.platform == "win32": self.win_notification.notify(title=title, message=message) if config.sections["notifications"][ "notification_popup_sound"]: import winsound winsound.PlaySound("SystemAsterisk", winsound.SND_ALIAS) return notification_popup = Gio.Notification.new(title) notification_popup.set_body(message) if self.frame.images["notify"]: notification_popup.set_icon(self.frame.images["notify"]) notification_popup.set_priority(priority) self.application.send_notification(None, notification_popup) if config.sections["notifications"]["notification_popup_sound"]: Gdk.beep() except Exception as error: log.add(_("Unable to show notification popup: %s"), str(error))
def set_title(self, user=None): app_name = GLib.get_application_name() if self.frame.hilites["rooms"] == [] and self.frame.hilites[ "private"] == []: # Reset Title self.frame.MainWindow.set_title(app_name) elif self.frame.np.config.sections["notifications"][ "notification_window_title"]: # Private Chats have a higher priority if len(self.frame.hilites["private"]) > 0: user = self.frame.hilites["private"][-1] self.frame.MainWindow.set_title( app_name + " - " + _("Private Message from %(user)s") % {'user': user}) # Allow for the possibility the username is not available elif len(self.frame.hilites["rooms"]) > 0: room = self.frame.hilites["rooms"][-1] if user is None: self.frame.MainWindow.set_title( app_name + " - " + _("You've been mentioned in the %(room)s room") % {'room': room}) else: self.frame.MainWindow.set_title( app_name + " - " + _("%(user)s mentioned you in the %(room)s room") % { 'user': user, 'room': room })
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 show_message(self, msg, text, newmessage=True): if msg.user in self.frame.np.config.sections["server"]["ignorelist"]: return if msg.user in self.frame.np.users and isinstance( self.frame.np.users[msg.user].addr, tuple): ip, port = self.frame.np.users[msg.user].addr if self.frame.np.ip_ignored(ip): return elif newmessage: self.frame.np.queue.put(slskmessages.GetPeerAddress(msg.user)) self.frame.np.private_message_queue_add(msg, text) return user_text = self.frame.np.pluginhandler.incoming_private_chat_event( msg.user, text) if user_text is None: return (u, text) = user_text self.send_message(msg.user, None) chat = self.users[msg.user] self.request_changed(chat.Main) # Hilight main private chats Label self.frame.request_tab_icon(self.frame.PrivateChatTabLabel) # Show notifications if the private chats notebook isn't selected, # the tab is not selected, or the main window isn't mapped if self.get_current_page() != self.page_num(chat.Main) or \ self.frame.MainNotebook.get_current_page() != self.frame.MainNotebook.page_num(self.frame.privatechatvbox) or \ not self.frame.MainWindow.get_property("visible"): self.frame.notifications.add("private", msg.user) if self.frame.np.config.sections["notifications"][ "notification_popup_private_message"]: self.frame.notifications.new_notification( text, title=_("Private message from %s") % msg.user, priority=Gio.NotificationPriority.HIGH) # SEND CLIENT VERSION to user if the following string is sent ctcpversion = 0 if text == CTCP_VERSION: ctcpversion = 1 text = "CTCP VERSION" self.users[msg.user].show_message(text, newmessage, msg.timestamp) if ctcpversion and self.frame.np.config.sections["server"][ "ctcpmsgs"] == 0: self.send_message(msg.user, GLib.get_application_name() + " " + version) self.frame.np.pluginhandler.incoming_private_chat_notification( msg.user, text)
def on_get_a_users_ip(self, *args): users = (i[0] for i in config.sections["server"]["userlist"]) combo_box_dialog( parent=self.frame.application.get_active_window(), title=GLib.get_application_name() + ": " + _("Get A User's IP"), message=_('Enter the User whose IP Address you wish to receive:'), callback=self.on_get_a_users_ip_response, droplist=users)
def __init__(self): Gtk.Application.__init__( self, application_id='org.gajim.Gajim', flags=(Gio.ApplicationFlags.HANDLES_COMMAND_LINE | Gio.ApplicationFlags.HANDLES_OPEN)) self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show the application\'s version')) self.add_main_option('quiet', ord('q'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show only critical errors')) self.add_main_option( 'separate', ord('s'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Separate profile files completely (even ' 'history database and plugins)')) self.add_main_option( 'verbose', ord('v'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Print XML stanzas and other debug ' 'information')) self.add_main_option( 'profile', ord('p'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Use defined profile in configuration ' 'directory'), 'NAME') self.add_main_option('config-path', ord('c'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Set configuration directory'), 'PATH') self.add_main_option('loglevel', ord('l'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Configure logging system'), 'LEVEL') self.add_main_option('warnings', ord('w'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show all warnings')) self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Open IPython shell')) self.add_main_option('show-next-pending-event', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Pops up a window with the next pending event')) self.add_main_option('start-chat', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Start a new chat')) self.add_main_option_entries(self._get_remaining_entry()) self.connect('handle-local-options', self._handle_local_options) self.connect('command-line', self._handle_remote_options) self.connect('startup', self._startup) self.connect('activate', self._activate) self.profile = '' self.config_path = None self.profile_separation = False self.interface = None GLib.set_prgname('gajim') if GLib.get_application_name() != 'Gajim': GLib.set_application_name('Gajim')
def on_get_a_users_info(self, *args): users = (i[0] for i in config.sections["server"]["userlist"]) entry_dialog( parent=self.frame.application.get_active_window(), title=GLib.get_application_name() + ": " + _("Request User Info"), message=_( 'Enter the name of a user whose info you wish to receive:'), callback=self.on_get_a_users_info_response, droplist=users)
def on_open_private_chat(self, *args): users = (i[0] for i in config.sections["server"]["userlist"]) combo_box_dialog( parent=self.frame.application.get_active_window(), title=GLib.get_application_name() + ": " + _("Start Messaging"), message=_( 'Enter the User who you wish to send a private message:'), callback=self.on_open_private_chat_response, droplist=users)
def new_notification(self, message, title=None, priority=Gio.NotificationPriority.NORMAL): if title is None: title = GLib.get_application_name() try: if sys.platform == "win32": """ Windows notification popup support via plyer Once https://gitlab.gnome.org/GNOME/glib/-/issues/1234 is implemented, we can drop plyer """ from plyer import notification notification.notify(app_name=GLib.get_application_name(), title=title, message=message) if self.frame.np.config.sections["notifications"][ "notification_popup_sound"]: import winsound winsound.PlaySound("SystemAsterisk", winsound.SND_ALIAS) return notification_popup = Gio.Notification.new(title) notification_popup.set_body(message) if self.frame.images["notify"]: notification_popup.set_icon(self.frame.images["notify"]) notification_popup.set_priority(priority) self.application.send_notification(None, notification_popup) if self.frame.np.config.sections["notifications"][ "notification_popup_sound"]: Gdk.beep() except Exception as error: log.add(_("Unable to show notification popup: %s"), str(error))
def load(self): """ Create """ if self.trayicon is None: if self.appindicator is not None: trayicon = self.appindicator.Indicator.new( GLib.get_application_name(), "", self.appindicator.IndicatorCategory.APPLICATION_STATUS) trayicon.set_menu(self.tray_popup_menu) # Action to hide/unhide main window when middle clicking the tray icon hide_unhide_item = self.tray_popup_menu.get_items()[_("Hide / Show Nicotine+")] trayicon.set_secondary_activate_target(hide_unhide_item) else: # GtkStatusIcon fallback trayicon = self.gtk.StatusIcon() trayicon.set_tooltip_text(GLib.get_application_name()) trayicon.connect("activate", self.on_hide_unhide_window) trayicon.connect("popup-menu", self.on_status_icon_popup) self.trayicon = trayicon """ Set up icons """ self.final_icon_path = self.get_final_icon_path() # If custom icon path was found, use it, otherwise we fall back to system icons if self.appindicator is not None and self.final_icon_path: self.trayicon.set_icon_theme_path(self.final_icon_path) """ Set visible """ if self.appindicator is not None: self.trayicon.set_status(self.appindicator.IndicatorStatus.ACTIVE) else: # GtkStatusIcon fallback self.trayicon.set_visible(True) self.set_image(self.tray_status["status"])
def add(self, uri): gio_file = Gio.File.new_for_uri(uri) recent_data = Gtk.RecentData() recent_data.display_name = gio_file.get_basename() recent_data.description = None recent_data.mime_type, _ = Gio.content_type_guess(uri) recent_data.app_name = GLib.get_application_name() recent_data.app_exec = "%s %%u" % GLib.get_prgname() #recent_data.groups = []; recent_data.is_private = False self.recent_manager.add_full(uri, recent_data)
def on_get_a_users_shares(self, widget, prefix=""): users = [] for entry in self.frame.np.config.sections["server"]["userlist"]: users.append(entry[0]) users.sort() user = combo_box_dialog( parent=self.frame.MainWindow, title=GLib.get_application_name() + ": " + _("Get A User's Shares List"), message=_('Enter the User whose Shares List you wish to receive:'), droplist=users ) if user: self.frame.browse_user(user)
def on_get_a_users_info(self, widget, prefix=""): # popup users = [] for entry in self.frame.np.config.sections["server"]["userlist"]: users.append(entry[0]) users.sort() user = combo_box_dialog( parent=self.frame.MainWindow, title=GLib.get_application_name() + ": " + _("Get User Info"), message=_('Enter the User whose User Info you wish to receive:'), droplist=users) if user: self.frame.local_user_info_request(user)
def on_get_a_users_ip(self, widget, prefix=""): users = [] for entry in self.frame.np.config.sections["server"]["userlist"]: users.append(entry[0]) users.sort() user = combo_box_dialog( parent=self.frame.MainWindow, title=GLib.get_application_name() + ": " + _("Get A User's IP"), message=_('Enter the User whose IP Address you wish to receive:'), droplist=users) if user: self.frame.np.ip_requested.add(user) self.frame.np.queue.put(slskmessages.GetPeerAddress(user))
def __init__(self, title=None, default_width=640, default_height=480, **kw): if not title: title = GLib.get_application_name() super().__init__(title=title, default_width=default_width, default_height=default_height, **kw) util.init_actions(self, [{ 'name': 'about', 'activate': self._about }]) builder = Gtk.Builder() builder.add_from_resource('@PACKAGE_DBUS_PATH@/main.ui') self.set_titlebar(builder.get_object('main-header')) grid = builder.get_object('main-grid') self.add(grid)
def __init__(self): Gtk.Application.__init__(self, application_id='org.gajim.Gajim') self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show the application\'s version')) self.add_main_option('quiet', ord('q'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show only critical errors')) self.add_main_option( 'separate', ord('s'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Separate profile files completely (even ' 'history db and plugins)')) self.add_main_option( 'verbose', ord('v'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Print XML stanzas and other debug ' 'information')) self.add_main_option( 'profile', ord('p'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Use defined profile in configuration ' 'directory'), 'NAME') self.add_main_option('config-path', ord('c'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Set configuration directory'), 'PATH') self.add_main_option('loglevel', ord('l'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Configure logging system'), 'LEVEL') self.add_main_option('warnings', ord('w'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show all warnings')) self.add_main_option(GLib.OPTION_REMAINING, 0, GLib.OptionFlags.HIDDEN, GLib.OptionArg.STRING_ARRAY, "") self.connect('handle-local-options', self._handle_local_options) self.connect('startup', self._startup) self.connect('activate', self._activate) self.profile = '' self.config_path = None self.profile_separation = False self.interface = None GLib.set_prgname('gajim') if GLib.get_application_name() != 'Gajim': GLib.set_application_name('Gajim')
def on_open_private_chat(self, widget, prefix=""): # popup users = [] for entry in self.frame.np.config.sections["server"]["userlist"]: users.append(entry[0]) users.sort() user = combo_box_dialog( parent=self.frame.MainWindow, title=GLib.get_application_name() + ": " + _("Start Messaging"), message=_('Enter the User who you wish to send a private message:'), droplist=users ) if user: self.frame.privatechats.send_message(user, show_user=True) self.frame.change_main_page("private") self.show_window()
def set_image(self, status=None): if not self.is_visible(): return try: if status is not None: self.tray_status["status"] = status # Check for hilites, and display hilite icon if there is a room or private hilite if self.frame.hilites["rooms"] or self.frame.hilites["private"]: icon_name = "msg" else: # If there is no hilite, display the status icon_name = self.tray_status["status"] if icon_name != self.tray_status["last"]: self.tray_status["last"] = icon_name if self.appindicator is not None: if self.custom_icons: icon_name = "trayicon_" + icon_name else: icon_name = GLib.get_prgname() + "-" + icon_name self.trayicon.set_icon_full(icon_name, GLib.get_application_name()) else: # GtkStatusIcon fallback if self.custom_icons or self.local_icons: self.trayicon.set_from_pixbuf( self.frame.images["trayicon_" + icon_name]) else: self.trayicon.set_from_icon_name(GLib.get_prgname() + "-" + icon_name) except Exception as e: log.add_warning(_("ERROR: cannot set trayicon image: %(error)s"), {'error': e})
def __init__(self, title=None, default_width=640, default_height=480, **kw): if not title: title = GLib.get_application_name() super().__init__(title=title, default_width=default_width, default_height=default_height, **kw) util.init_actions(self, [{'name': 'about', 'activate': self._about}]) builder = Gtk.Builder() builder.add_from_resource('@PACKAGE_DBUS_PATH@/main.ui') self.set_titlebar(builder.get_object('main-header')) grid = builder.get_object('main-grid') self.add(grid)
def show_message(self, msg, text, newmessage=True): if self.frame.np.network_filter.is_user_ignored(msg.user): return if msg.user in self.frame.np.users and isinstance( self.frame.np.users[msg.user].addr, tuple): ip, port = self.frame.np.users[msg.user].addr if self.frame.np.network_filter.is_ip_ignored(ip): return elif newmessage: self.frame.np.queue.append(slskmessages.GetPeerAddress(msg.user)) self.private_message_queue_add(msg, text) return user_text = self.frame.np.pluginhandler.incoming_private_chat_event( msg.user, text) if user_text is None: return (u, text) = user_text self.send_message(msg.user, None) self.show_notification(msg.user, text) # SEND CLIENT VERSION to user if the following string is sent ctcpversion = 0 if text == self.CTCP_VERSION: ctcpversion = 1 text = "CTCP VERSION" self.users[msg.user].show_message(text, newmessage, msg.timestamp) if ctcpversion and config.sections["server"]["ctcpmsgs"] == 0: self.send_message(msg.user, GLib.get_application_name() + " " + version) self.frame.np.pluginhandler.incoming_private_chat_notification( msg.user, text)
def set_image(self, status=None): if not self.is_visible(): return if status is not None: self.tray_status["status"] = status # Check for hilites, and display hilite icon if there is a room or private hilite if (self.frame.np.notifications and (self.frame.np.notifications.chat_hilites["rooms"] or self.frame.np.notifications.chat_hilites["private"])): icon_name = "msg" else: # If there is no hilite, display the status icon_name = self.tray_status["status"] if icon_name != self.tray_status["last"]: self.tray_status["last"] = icon_name if self.custom_icons: icon_name = "trayicon_" + icon_name else: icon_name = GLib.get_prgname() + "-" + icon_name if self.appindicator is not None: self.tray_icon.set_icon_full(icon_name, GLib.get_application_name()) else: # GtkStatusIcon fallback if self.custom_icons: self.tray_icon.set_from_pixbuf(self.frame.images[icon_name]) else: self.tray_icon.set_from_icon_name(icon_name)
def __init__(self, title=None, default_width=1000, default_height=800, **kw): if not title: title = GLib.get_application_name() super().__init__(title=title, default_width=default_width, default_height=default_height, **kw) util.init_actions(self, [{ 'name': 'about', 'activate': self._about }]) self.builder = Gtk.Builder() self.builder.add_from_resource('/org/madbob/Assetxplorer/main.ui') self.set_titlebar(self.builder.get_object('main-header')) self.new_button = self.builder.get_object('new-button') self.new_button.connect('clicked', self._on_new_folder) self.back_button = self.builder.get_object('back-button') self.back_button.connect('clicked', self._on_back) self.stack = self.builder.get_object('main-stack') self.add(self.stack) self.stack.show_all() self.viewer = self.builder.get_object('contents') self.folderslist = self.builder.get_object('list') self.folderslist.get_style_context().add_class("assetxplorer-folders") self.folderslist.connect('row-activated', self._view_folder) self.conf = util.get_settings('org.madbob.Assetxplorer') folders = self.conf.get_value('folders') if folders: self.stack.set_visible_child(self.folderslist) for f in folders: self._create_button(f) else: empty = self.builder.get_object('empty') self.stack.set_visible_child(empty)
def get_window_title_for_note_title(self, note_title): progname = GLib.get_application_name() title = "%s: %s" % (progname, note_title) return title
def __init__(self, **kwargs): super().__init__(**kwargs) #uff=[{"title_repr":"Convert to wav","subtitle_repr":"wav","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"wav"}]}},{"title_repr":"Convert to mp3","subtitle_repr":"mp3","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"mp3"}]}},{"title_repr":"Convert to aac","subtitle_repr":"aac","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"aac"}]}},{"title_repr":"Convert to flac","subtitle_repr":"flac","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"flac"}]}},{"title_repr":"Convert to m4a","subtitle_repr":"m4a","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"m4a"}]}},{"title_repr":"Convert to opus","subtitle_repr":"opus","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"opus"}]}},{"title_repr":"Convert to vorbis","subtitle_repr":"vorbis","icon_name":"audio-x-generic-symbolic","ydl_opts":{'extractaudio':True,'postprocessors':[{'key': 'FFmpegExtractAudio', 'preferredcodec':"vorbis"}]}},{"title_repr":"Convert to mp4","subtitle_repr":"mp4","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"mp4"}]}},{"title_repr":"Convert to flv","subtitle_repr":"flv","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"flv"}]}},{"title_repr":"Convert to ogg","subtitle_repr":"ogg","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"ogg"}]}},{"title_repr":"Convert to avi","subtitle_repr":"avi","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"avi"}]}},{"title_repr":"Convert to mkv","subtitle_repr":"mkv","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"mkv"}]}},{"title_repr":"Convert to webm","subtitle_repr":"webm","icon_name":"video-x-generic-symbolic","ydl_opts":{'postprocessors':[{'key': 'FFmpegVideoConvertor', 'format':"webm"}]}}] #for u in uff: # ar=FormatsRow(u["icon_name"],u["title_repr"],u["subtitle_repr"],u["ydl_opts"]) # self.conversionlb.prepend(ar) for a in self.conversionlb.get_children(): if a.get_subtitle() in ['mp4', 'webm', 'mkv', 'avi', 'ogg', 'flv']: a.ydl_opts = { 'postprocessors': [{ 'key': 'FFmpegVideoConvertor', 'format': a.get_subtitle() }] } elif a.get_subtitle() in [ 'mp3', 'wav', 'vorbis', 'opus', 'm4a', 'flac', 'aac' ]: a.ydl_opts = { 'extractaudio': True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': a.get_subtitle() }] } self.leaflet2.connect("notify::folded", self.on_leaflet_visible_changed) self.dnd_stack.drag_dest_set(Gtk.DestDefaults.ALL, [], Gdk.DragAction.COPY) self.dnd_stack.drag_dest_add_text_targets() self.set_property("lstore", Gio.ListStore.new(Item)) self.gtklb.bind_model(self.lstore, self.mflb) self.lstore.connect("items_changed", self.on_lstore_items_changed) self.empty_state = Dazzle.EmptyState( visible=True, icon_name=self.get_application().get_application_id() + "-symbolic", title=GLib.get_application_name(), subtitle= "• Click ➕ above to type in URL or to search,\n• click 📋 above to paste URL from Clipboard, or\n• Drag-and-Drop URL here." ) self.dnd_stack.add(self.empty_state) self.on_lstore_items_changed(None, None, None, None) self.set_property("downloadprogressliststore", Gio.ListStore.new(DownloadProgressItem)) self.refresh_bind_model() self.ficb.set_current_folder(DEFAULT_DOWNLOAD_FOLDER) self.authentification_expander_row.connect( "notify::enable-expansion", self.on_authentification_expander_row_enable_expansion_changed) self.custom_code_expander_row.connect( "notify::enable-expansion", self.on_custom_code_expander_row_enable_expansion_changed) self.geobypass_expander_row.connect( "notify::enable-expansion", self.on_geobypass_expander_row_enable_expansion_changed)
def test_appname(self): GLib.set_application_name("moo") self.assertEqual(GLib.get_application_name(), "moo")
def test_appname(self): GLib.set_application_name('moo') self.assertEqual(GLib.get_application_name(), 'moo')
def __init__(self): flags = (Gio.ApplicationFlags.HANDLES_COMMAND_LINE | Gio.ApplicationFlags.HANDLES_OPEN) Gtk.Application.__init__(self, application_id='org.gajim.Gajim', flags=flags) # required to track screensaver state self.props.register_session = True self.add_main_option('version', ord('V'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show the application\'s version')) self.add_main_option('quiet', ord('q'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show only critical errors')) self.add_main_option( 'separate', ord('s'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Separate profile files completely ' '(even history database and plugins)')) self.add_main_option( 'verbose', ord('v'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Print XML stanzas and other debug information')) self.add_main_option( 'profile', ord('p'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Use defined profile in configuration directory'), 'NAME') self.add_main_option('config-path', ord('c'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Set configuration directory'), 'PATH') self.add_main_option('loglevel', ord('l'), GLib.OptionFlags.NONE, GLib.OptionArg.STRING, _('Configure logging system'), 'LEVEL') self.add_main_option('warnings', ord('w'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Show all warnings')) self.add_main_option('ipython', ord('i'), GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Open IPython shell')) self.add_main_option('show-next-pending-event', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Pops up a window with the next pending event')) self.add_main_option('start-chat', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Start a new chat')) self.add_main_option('simulate-network-lost', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Simulate loss of connectivity')) self.add_main_option('simulate-network-connected', 0, GLib.OptionFlags.NONE, GLib.OptionArg.NONE, _('Simulate regaining connectivity')) self.add_main_option_entries(self._get_remaining_entry()) self.connect('handle-local-options', self._handle_local_options) self.connect('command-line', self._handle_remote_options) self.connect('startup', self._startup) self.connect('activate', self._activate) if sys.platform not in ('win32', 'darwin'): self.connect("notify::screensaver-active", self._screensaver_active) self.interface = None GLib.set_prgname('gajim') if GLib.get_application_name() != 'Gajim': GLib.set_application_name('Gajim')