Skip to content
Permalink
Browse files

Add statusbar for notifications

  • Loading branch information...
corenominal committed Aug 5, 2016
1 parent 2c531c9 commit 144ede285209dd68d06ab8b1026a546e28b381b8
Showing with 31 additions and 0 deletions.
  1. +6 −0 src/pwgenGUI
  2. +25 −0 src/pwgenGUI.glade
@@ -18,6 +18,8 @@ class pwgenGUI:
self.builder.add_from_file(self.gladefile)
self.builder.connect_signals(self)
self.window_main = self.builder.get_object("pwgenGUI")
self.statusbar = self.builder.get_object("statusbar")
self.statusbar_id = self.statusbar.get_context_id("pwgenGUI")
self.aboutdialog = self.builder.get_object("aboutdialog")
self.password_input = self.builder.get_object("password_input")
self.password_input.modify_font(Pango.FontDescription('Ubuntu Mono 18'))
@@ -100,6 +102,8 @@ class pwgenGUI:
f = open(self.settings_file, 'w')
f.write(settings)
f.close()
self.statusbar.pop(self.statusbar_id)
# self.genPassword(self)

def on_menu_about_activate(self, button):
response = self.aboutdialog.run()
@@ -110,6 +114,7 @@ class pwgenGUI:
self.genPassword(self)

def on_password_input_changed(self, button):
self.statusbar.pop(self.statusbar_id)
password = self.password_input.get_text()
if len(password) == 0:
self.button_copy.set_sensitive(False)
@@ -122,6 +127,7 @@ class pwgenGUI:
password = self.password_input.get_text()
if len(password) > 0:
self.clipboard.set_text(password, -1)
self.statusbar.push(self.statusbar_id, "Password copied to clipboard!")

def on_pwgenGUI_destroy(self, object):
Gtk.main_quit()
@@ -134,6 +134,7 @@
<object class="GtkToolButton" id="toolbutton_new">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Generate new password</property>
<property name="label" translatable="yes">New</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-new</property>
@@ -148,6 +149,7 @@
<object class="GtkToolButton" id="toolbutton_copy">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Copy password to clipboard</property>
<property name="label" translatable="yes">Copy</property>
<property name="use_underline">True</property>
<property name="stock_id">gtk-copy</property>
@@ -170,6 +172,8 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">20</property>
<property name="orientation">vertical</property>
<property name="spacing">20</property>
<child>
<object class="GtkEntry" id="password_input">
<property name="name">password_input</property>
@@ -189,6 +193,26 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkStatusbar" id="statusbar">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">10</property>
<property name="margin_right">10</property>
<property name="margin_start">10</property>
<property name="margin_end">10</property>
<property name="margin_top">6</property>
<property name="margin_bottom">6</property>
<property name="orientation">vertical</property>
<property name="spacing">2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">3</property>
</packing>
</child>
@@ -309,6 +333,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">4</property>
</packing>
</child>

0 comments on commit 144ede2

Please sign in to comment.
You can’t perform that action at this time.