Page 1 of 2 12 LastLast
Results 1 to 10 of 19

Thread: Critique My First GUI

  1. #1
    Join Date
    Jul 2006
    Beans
    Hidden!

    Critique My First GUI

    I have just written a little password generator python script and GUI with Glade and PyGTK. I have attached it below, (the file to run is passgen_gui.py). I am somewhat pleased with it but I would like input. Here are a few of my concerns:

    1. When the expander is expanded, it pushes the buttons at the buttom down. When it is collapsed, the buttons at the bottom do not come back up, leaving a big ugly space. Is there a way to make the buttons "come back up"? GIMP's menus do this so I'm sure it's possible, I just don't have a clue how.

    2. I would like to have the configuration of the GUI saved (what checkboxes are checked, what is in the text fields, whether or not the expander is expanded, etc...) and restored when passgen starts up again. On an earlier version of this program, I tried doing that by writing to and reading from a file but that seems kind of messy to me. Another option is using a class full of variables and pickling the class object but I haven't looked into that fully yet. What are my options?

    3. Using glade did reduce the size of the file by quite a bit. However, the method I have to import each widget with gtk.glade.XML.get_widget() is a bit tedious (lines 54-65 of passgen_gui.py). Is there a better way?

    Guidance is much appreciated.
    Attached Files Attached Files
    Last edited by fatsheep; August 7th, 2007 at 07:04 PM.

  2. #2
    Join Date
    Mar 2007
    Location
    /Earth/USA/MD/Home
    Beans
    826
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Critique My First GUI

    Quote Originally Posted by fatsheep View Post
    I have just written a little password generator python script and GUI with Glade and PyGTK. I have attached it below, (the file to run is passgen_gui.py). I am somewhat pleased with it but I would like input. Here are a few of my concerns:

    1. When the expander is expanded, it pushes the buttons at the buttom down. When it is collapsed, the buttons at the bottom do not come back up, leaving a big ugly space. Is there a way to make the buttons "come back up"? GIMP's menus do this so I'm sure it's possible, I just don't have a clue how.

    2. I would like to have the configuration of the GUI saved (what checkboxes are checked, what is in the text fields, whether or not the expander is expanded, etc...) and restored when passgen starts up again. On an earlier version of this program, I tried doing that by writing to and reading from a file but that seems kind of messy to me. Another option is using a class full of variables and pickling the class object but I haven't looked into that fully yet. What are my options?

    3. Using glade did reduce the size of the file by quite a bit the way I have to import each widget with gtk.glade.XML.get_widget() is a bit tedious (lines 54-65 of passgen_gui.py). Is there a better way?

    Guidance is much appreciated.
    Nice. I am a few steps behind you in my learning. I am working on a project to make a front-end to the CLI program find. My main objective with this is to beable to use Regex filesystem searching from a GUI. As such, I too am interested in seeing if there is an easier way to import the widgets.
    In Soviet Russia, cake lies you!
    My Blog | Email Me

  3. #3
    Join Date
    Aug 2005
    Location
    The Local Group
    Beans
    631

    Re: Critique My First GUI

    Not bad at all. Possible extension: allow the user to specify that certain characters must appear in the password (e. g., password must contain at least one digit, one lowercase letter, and one capital letter).

  4. #4
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Critique My First GUI

    Randomly generated passwords were tested and proved to be - hard to memorize, so users hate them. Instead, better methods are suggested.

    I have no problem with your program as training task (it's nice effort etc), but I wanted you to warn about inflicting your program on some innocent bystanders

  5. #5
    Join Date
    Jul 2006
    Beans
    Hidden!

    Re: Critique My First GUI

    Quote Originally Posted by pmasiar View Post
    Randomly generated passwords were tested and proved to be - hard to memorize, so users hate them. Instead, better methods are suggested.

    I have no problem with your program as training task (it's nice effort etc), but I wanted you to warn about inflicting your program on some innocent bystanders
    Fair enough but how would I make this program generate easy to remember passwords?

  6. #6
    Join Date
    Mar 2007
    Location
    /Earth/USA/MD/Home
    Beans
    826
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Critique My First GUI

    Quote Originally Posted by fatsheep View Post
    Fair enough but how would I make this program generate easy to remember passwords?
    Maybe take user input for a few words. And make a password from them.
    Like you ask the user for some words they associate with themselves. Maybe they put a city, pets name, or something. Then you mix them around to generate a password. I remmber AOL did this sometime before.
    In Soviet Russia, cake lies you!
    My Blog | Email Me

  7. #7
    Join Date
    Jun 2006
    Location
    CT, USA
    Beans
    5,267
    Distro
    Ubuntu 6.10 Edgy

    Re: Critique My First GUI

    Quote Originally Posted by Nekiruhs View Post
    Like you ask the user for some words they associate with themselves. Maybe they put a city, pets name, or something.
    This is exactly the *wrong* way to do it, and link above described why, did you bothered to read it?

    You don't need program for it: user can make up a (longish) sentence which will be easy to remember.

    If you want, you may make user to enter the sentence, and then make some magic on first letters: replace with 1337-speak, '=' instead of 'is' etc, but it is better made by user.

  8. #8
    Join Date
    Jul 2006
    Beans
    Hidden!

    Re: Critique My First GUI

    Quote Originally Posted by pmasiar View Post
    If you want, you may make user to enter the sentence, and then make some magic on first letters: replace with 1337-speak, '=' instead of 'is' etc, but it is better made by user.
    That's not a bad idea. I'll try that.

  9. #9
    Join Date
    Mar 2007
    Location
    /Earth/USA/MD/Home
    Beans
    826
    Distro
    Ubuntu 7.10 Gutsy Gibbon

    Re: Critique My First GUI

    I just thought of it! We could do a big for loop for every line in the .glade file. Then check to see if the line matches a Regex, when we find the line that contains the name of the widget, extract it with regex and pass it to GTK.
    In Soviet Russia, cake lies you!
    My Blog | Email Me

  10. #10
    Join Date
    Jul 2006
    Beans
    Hidden!

    Re: Critique My First GUI

    Quote Originally Posted by Nekiruhs View Post
    I just thought of it! We could do a big for loop for every line in the .glade file. Then check to see if the line matches a Regex, when we find the line that contains the name of the widget, extract it with regex and pass it to GTK.
    What is this for? Extracting widgets from the xml? If so, there's an inbuilt function for that. gtk.glade.XML is the XML class which has the get_widget(widget_name) function. So...

    Code:
    xml = gtk.glade.XML("yourgladefile.glade")
    window = xml.get_widget("window1")
    would import the "window1" widget from the glade XML file as window. For more information, see the gtk.glade.XML pyGTK class reference page:

    http://www.pygtk.org/docs/pygtk/class-gladexml.html

    Also, check out the gui script in the attached archive as I use this method.

Page 1 of 2 12 LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •