def remove(self): """ Remove the account. """ Database.get_default().delete_account(self.id) Keyring.get_default().remove(self._token_id) self.emit("removed") Logger.debug("Account '{}' with id {} was removed".format( self.username, self.id))
def _setup_css(self): """Setup the CSS and load it.""" Logger.debug("Loading CSS") provider = Gtk.CssProvider() provider.load_from_resource( '/com/github/bilelmoussaoui/Authenticator/style.css') Gtk.StyleContext().add_provider_for_screen( Gdk.Screen.get_default(), provider, Gtk.STYLE_PROVIDER_PRIORITY_USER) Gtk.IconTheme.get_default().add_resource_path( "/com/github/bilelmoussaoui/Authenticator/icons")
def restore_state(self): """ Restore the window's state. """ settings = Settings.get_default() # Restore the window position position_x, position_y = settings.window_position if position_x != 0 and position_y != 0: self.move(position_x, position_y) Logger.debug("[Window] Restore position x: {}, y: {}".format( position_x, position_y)) else: # Fallback to the center self.set_position(Gtk.WindowPosition.CENTER) if settings.window_maximized: self.maximize()