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, parent, window, app): Thread.__init__(self) Gtk.ListBoxRow.__init__(self) # Read default values cfg = SettingsReader() self.counter_max = cfg.read("refresh-time", "preferences") self.counter = self.counter_max self.window = window self.parent = parent self.id = app[0] self.name = app[1] self.secret_code = Database.fetch_secret_code(app[2]) if self.secret_code: self.code = Code(self.secret_code) else: self.code_generated = False logging.error( "Could not read the secret code from, the keyring keys were reset manually" ) self.logo = app[3] # Create needed widgets self.code_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL) self.revealer = Gtk.Revealer() self.checkbox = Gtk.CheckButton() self.application_name = Gtk.Label(xalign=0) self.code_label = Gtk.Label(xalign=0) self.timer_label = Gtk.Label(xalign=0) # Create the list row self.create_row() self.start() self.window.connect("key-press-event", self.__on_key_press)
def __init__(self, parent): self.parent = parent self.cfg = SettingsReader() self.notebook = Gtk.Notebook() self.auto_lock_time = Gtk.SpinButton() self.enable_switch = Gtk.CheckButton() self.auto_lock_switch = Gtk.CheckButton() self.password_button = Gtk.Button() self.generate_window() self.generate_components()
def __init__(self, window): self.parent = window self.cfg = SettingsReader() self.hb = Gtk.HeaderBar() self.apply_button = Gtk.Button.new_with_label(_("Apply")) self.new_entry = Gtk.Entry() self.new2_entry = Gtk.Entry() self.old_entry = Gtk.Entry() self.generate_window() self.generate_components() self.generate_header_bar()