Hallo,
ich möchte ein Programm schreiben, was die Installation des Hamachi-Linux-Clients vereinfachen soll. Es soll grafisch sein und pygtk nutzen. Dabei soll es im Grunde nur eine art Installations Assistent sein der einem die ganze Arbeit abnimmt wie die Installation des Systemdienstes, das Schreiben des Autostart Scriptes, Das Installieren des grafischen gHamachi und das Eintragen ins Menü usw.
Da liegt aber nicht das Problem sondern ich weiß nicht wie man am besten einen Wizard mit GTK und Glade hinbekommt - Soll ich für das wechseln der Assistent Seiten eine extra Klasse erstellen? Wenn ja, was muss die alles machen?
Lohnt es sich das Gnome-Assistent Widget zu nehmen oder hat das keine Vorteile und braucht nur unnötige Gnome-Libs?
(Es muss nicht unbedingt Gtk 2.8 kompatibel sein. Also es kann ruhig über gtk.Assistant laufen. Wenn nötig pack ich das ganze zusammen mit GTK mit Pyinstaller damit es überall lauffähig ist)
Gruß und Danke schonmal,
foxx
Assistent mit pyGTK
[url=http://www.php4you.de/]PHP4You[/url]
[url=http://forum.php4you.de]PHP4You-Forum[/url]
[url=http://janek.php4you.de/]Mein Blog[/url]
[url=http://www.php4you.de/against_icq.html]Against ICQ[/url]
[url=http://forum.php4you.de]PHP4You-Forum[/url]
[url=http://janek.php4you.de/]Mein Blog[/url]
[url=http://www.php4you.de/against_icq.html]Against ICQ[/url]
So, ich hab es doch geschafft nun mehr schlecht als recht einen mini Assistenten zusammen zu bauen aber ich denke vom Code ist das nicht unbedingt sehr sehenswert
Könnt ihr mir vielleicht ein paar Tipps geben?
Glade-Datei
Gruß,
foxx
Könnt ihr mir vielleicht ein paar Tipps geben?
Code: Alles auswählen
#!/usr/bin/env python
# imports
import sys
import gtk.glade
# Class of the main window
class gui:
def __init__(self):
''' Init '''
self.assistant = gtk.glade.XML(gladefile,'assistant1')
# Create dictionay with events
dic = { 'on_assistant1_close' : quit,
'on_assistant1_cancel' : quit,
'on_assistant1_destroy' : quit, }
# connect all events from the dictionary
self.assistant.signal_autoconnect(dic)
# build page 1
label = self.assistant.get_widget('label_start')
self.assistant.get_widget('assistant1').set_page_title(label, 'Hamachi Linux Wizard')
label.set_text(
'''Hello,
this assistant is going to allow you a simple installation of the Hamachi linux client.
This application is not official support by LogMeIn Inc. It's a developement by xxx and licensed under the terms of the GNU General Public license.
I can't give you any guaranty that this application will work nice on your system. I testes it with Ubuntu feisty fawn i386.
Please press "next" to continue.
''')
label.set_line_wrap(True)
self.assistant.get_widget('assistant1').set_page_complete(label, True)
# build page 2
label = gtk.Label('''
The used Hamachi components are going to be downloaded right now.
Please wait. This can take more than 5 minutes depending on your internet connection speed.
''')
label.set_line_wrap(True)
label.show()
self.assistant.get_widget('assistant1').append_page(label)
self.assistant.get_widget('assistant1').set_page_title(label, 'Downloading components')
self.assistant.get_widget('assistant1').set_page_complete(label, True)
# build last page
label = gtk.Label('''
Thank you and bye!
''')
label.set_line_wrap(True)
label.show()
self.assistant.get_widget('assistant1').append_page(label)
self.assistant.get_widget('assistant1').set_page_title(label, 'Finished')
self.assistant.get_widget('assistant1').set_page_type(label, gtk.ASSISTANT_PAGE_CONFIRM)
def quit(self):
gtk.main_quit()
if __name__ == '__main__':
gladefile = sys.path[0] + '/data/wizard.glade' #now right filename here
try:
fileread = open(gladefile)
fileread.close()
except:
print 'The file "%s" is not readable.' % gladefile
sys.exit(1)
app = gui()
gtk.main()
Code: Alles auswählen
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Sat Apr 14 16:46:39 2007 by janek@JanekPC-->
<glade-interface>
<widget class="GtkAssistant" id="assistant1">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<signal name="close" handler="on_assistant1_close"/>
<signal name="cancel" handler="on_assistant1_cancel"/>
<signal name="destroy" handler="on_assistant1_destroy"/>
<signal name="apply" handler="on_assistant1_apply"/>
<child>
<widget class="GtkLabel" id="label_start">
<property name="visible">True</property>
<property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
<property name="label" translatable="yes">Einführungsseite</property>
</widget>
<packing>
<property name="page_type">GTK_ASSISTANT_PAGE_INTRO</property>
</packing>
</child>
</widget>
</glade-interface>
foxx
[url=http://www.php4you.de/]PHP4You[/url]
[url=http://forum.php4you.de]PHP4You-Forum[/url]
[url=http://janek.php4you.de/]Mein Blog[/url]
[url=http://www.php4you.de/against_icq.html]Against ICQ[/url]
[url=http://forum.php4you.de]PHP4You-Forum[/url]
[url=http://janek.php4you.de/]Mein Blog[/url]
[url=http://www.php4you.de/against_icq.html]Against ICQ[/url]