From 36f2e9add1848a87f76d8f0a9ab02983c9f32a6f Mon Sep 17 00:00:00 2001 From: jeena Date: Mon, 5 Nov 2012 00:24:47 +0100 Subject: [PATCH] fixed Preference window look --- Linux/Tentia.py | 13 +++++--- Linux/TentiaWindows.py | 76 ++++++++++++++++++++++++++++++------------ 2 files changed, 62 insertions(+), 27 deletions(-) diff --git a/Linux/Tentia.py b/Linux/Tentia.py index 733304c..3204597 100755 --- a/Linux/Tentia.py +++ b/Linux/Tentia.py @@ -1,20 +1,23 @@ #!/usr/bin/env python -from gi.repository import Gtk +import gtk import TentiaWindows class Tentia: def __init__(self): self.setup_preferences_window() - self.preferences_window.show_all() - Gtk.main() + self.preferences_window.show() + gtk.main() - def quit(self): - Gtk.main_quit() + def quit(self, sender): + gtk.main_quit() def setup_preferences_window(self): self.preferences_window = TentiaWindows.Preferences(self) + def resources_path(self): + return "../" + if __name__ == "__main__": Tentia() \ No newline at end of file diff --git a/Linux/TentiaWindows.py b/Linux/TentiaWindows.py index 6a7a62e..a4384cf 100644 --- a/Linux/TentiaWindows.py +++ b/Linux/TentiaWindows.py @@ -1,41 +1,73 @@ -from gi.repository import Gtk -import webkit +import gtk, webkit -class Preferences(Gtk.Window): +class Preferences: def __init__(self, app): - self.app = app - Gtk.Window.__init__(self, title="Preferences") - self.connect("delete-event", self.quit) + self.window = gtk.Window() + self.window.set_title("Preferences") + self.window.set_position(gtk.WIN_POS_CENTER) + self.window.connect("delete-event", self.quit) - self.login_button = Gtk.Button(label="Login") + hbox1 = gtk.HBox() + self.window.add(hbox1) + + icon = gtk.Image() + pixbuffer = gtk.gdk.pixbuf_new_from_file(self.app.resources_path() + "Icon.png") + scaled_buffer = pixbuffer.scale_simple(150, 150, gtk.gdk.INTERP_BILINEAR) + icon.set_from_pixbuf(scaled_buffer) + hbox1.pack_start(icon, False, False, 20) + + fix = gtk.Fixed() + hbox1.pack_start(fix, False, False, 20) + + label = gtk.Label("Please enter your entity:") + fix.put(label, 0, 30) + + self.entity_entry = gtk.Entry() + self.entity_entry.set_width_chars(36) + fix.put(self.entity_entry, 0, 52) + + self.login_button = gtk.Button(label="Login") self.login_button.connect("clicked", self.on_login_button_clicked) - self.add(self.login_button) + fix.put(self.login_button, 248, 82) - def quit(self): - self.hide_all() + self.window.show_all() + self.window.hide() + + def quit(self, wiget, foo): + self.window.hide() self.app.quit(self) def on_login_button_clicked(self, widget): print "Login" + def show(self): + self.window.show() -class Timeline(Gtk.Window): + def hide(self): + self.window.hide() - def __init(self, app): +class Timeline: + + def __init__(self, app): self.app = app - Gtk.Window.__init__(self, title="Tentia") - self.connect("delete-event", self.quit) + self.window = gtk.Window() + self.window.connect("delete-event", self.quit) + + scroller = gtk.ScrollerWindow() + self.window.add(scroller) + self.web_view = webkit.WebView() - - scroller = gtk.StrolledWindow() - self.add(scroller) - scroller.show() scroller.add(self.web_view) - self.web_view.show() - self.web_view.open("http://google.com") - def quit(self) - self.hide_all() + + def quit(self, widget, foo): + self.window.hide() self.app.quit(self) + + def show(self): + self.window.show() + + def hide(self): + self.window.hide()