Changeset 44:5d48f6c9f140 for src/mlx
- Timestamp:
- 03/18/12 16:11:18 (13 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- src/mlx/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/mlx/gui/common.py
r42 r44 12 12 import gtk 13 13 import gobject 14 import pango 14 15 try: 15 16 import appindicator … … 27 28 from gi.repository import GObject as gobject 28 29 from gi.repository import AppIndicator3 as appindicator 30 from gi.repository import Pango as pango 29 31 appIndicator = True 30 32 -
src/mlx/gui/flight.py
r43 r44 5 5 #----------------------------------------------------------------------------- 6 6 7 class Page(gtk. VBox):7 class Page(gtk.Alignment): 8 8 """A page in the flight wizard.""" 9 def __init__(self, wizard ):9 def __init__(self, wizard, title, help): 10 10 """Construct the page.""" 11 super(Page, self).__init__() 11 super(Page, self).__init__(xalign = 0.0, yalign = 0.0, 12 xscale = 1.0, yscale = 1.0) 13 self.set_padding(padding_top = 4, padding_bottom = 4, 14 padding_left = 12, padding_right = 12) 15 16 frame = gtk.Frame() 17 self.add(frame) 18 19 print self.get_style() 20 style = self.get_style() if pygobject else self.rc_get_style() 21 22 self._vbox = gtk.VBox() 23 frame.add(self._vbox) 24 25 eventBox = gtk.EventBox() 26 eventBox.modify_bg(0, style.bg[3]) 27 28 alignment = gtk.Alignment(xalign = 0.0, xscale = 0.0) 29 30 label = gtk.Label(title) 31 label.modify_fg(0, style.fg[3]) 32 label.modify_font(pango.FontDescription("bold 24")) 33 alignment.set_padding(padding_top = 4, padding_bottom = 4, 34 padding_left = 6, padding_right = 0) 35 36 alignment.add(label) 37 eventBox.add(alignment) 38 39 self._vbox.pack_start(eventBox, False, False, 0) 40 41 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 42 xscale = 0, yscale = 0.3) 43 label = gtk.Label(help) 44 label.set_justify(gtk.Justification.CENTER if pygobject 45 else gtk.JUSTIFY_CENTER) 46 alignment.add(label) 47 self._vbox.pack_start(alignment, True, True, 0) 48 49 self._mainAlignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 50 xscale = 0, yscale = 0.0) 51 self._vbox.pack_start(self._mainAlignment, True, True, 0) 52 53 buttonAlignment = gtk.Alignment(xalign = 1.0, xscale=0.0) 54 buttonAlignment.set_padding(padding_top = 4, padding_bottom = 10, 55 padding_left = 16, padding_right = 16) 56 57 self._buttonBox = gtk.HButtonBox() 58 buttonAlignment.add(self._buttonBox) 59 60 self._vbox.pack_start(buttonAlignment, False, False, 0) 61 12 62 self._wizard = wizard 63 64 def setMainWidget(self, widget): 65 """Set the given widget as the main one.""" 66 self._mainAlignment.add(widget) 67 68 def addButton(self, label): 69 """Add a button with the given label. 70 71 Return the button object created.""" 72 button = gtk.Button(label) 73 self._buttonBox.add(button) 74 return button 13 75 14 76 #----------------------------------------------------------------------------- … … 18 80 def __init__(self, wizard): 19 81 """Construct the login page.""" 20 super(LoginPage, self).__init__(wizard) 21 22 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 23 xscale = 0, yscale = 0.3) 24 label = gtk.Label("Enter your pilot's ID and password to\n" 25 "log in to the MAVA website and download\n" 26 "your booked flights") 27 label.set_justify(gtk.Justification.CENTER if pygobject 28 else gtk.JUSTIFY_CENTER) 29 alignment.add(label) 30 self.pack_start(alignment, True, True, 0) 31 32 alignment = gtk.Alignment(xalign = 0.5, yalign = 0.5, 33 xscale = 0, yscale = 0.0) 82 help = "Enter your MAVA pilot's ID and password to\n" \ 83 "log in to the MAVA website and download\n" \ 84 "your booked flights." 85 super(LoginPage, self).__init__(wizard, "Login", help) 34 86 35 87 table = gtk.Table(2, 2) 36 88 table.set_row_spacings(4) 37 89 table.set_col_spacings(32) 38 alignment.add(table)90 self.setMainWidget(table) 39 91 40 92 labelAlignment = gtk.Alignment(xalign=1.0, xscale=0.0) … … 55 107 table.attach(self._password, 1, 2, 1, 2) 56 108 57 self.pack_start(alignment, True, True, 0) 58 59 alignment = gtk.Alignment(xalign = 1.0, xscale=0.0) 60 alignment.set_padding(padding_top = 4, padding_bottom = 10, 61 padding_left = 16, padding_right = 16) 62 63 self._loginButton = gtk.Button("Login") 109 self._loginButton = self.addButton("Login") 64 110 self._loginButton.set_sensitive(False) 65 111 self._loginButton.connect("clicked", self._loginClicked) 66 112 67 alignment.add(self._loginButton)68 self.pack_start(alignment, False, False, 0)69 70 113 config = self._wizard.gui.config 71 114 self._pilotID.set_text(config.pilotID) … … 123 166 def __init__(self, wizard): 124 167 """Construct the flight selection page.""" 125 super(FlightSelectionPage, self).__init__(wizard )126 self.pack_start(gtk.Label("Hello, te lo!"), False, False, 0)168 super(FlightSelectionPage, self).__init__(wizard, "Flight selection", 169 "Hello, te lo!") 127 170 128 171 #-----------------------------------------------------------------------------
Note:
See TracChangeset
for help on using the changeset viewer.