From: robk-tahoe Date: Tue, 18 Mar 2008 23:15:36 +0000 (-0700) Subject: confwiz: reworked confwiz look and feel X-Git-Tag: allmydata-tahoe-1.0.0~25 X-Git-Url: https://git.rkrishnan.org/pf/content//%22%22?a=commitdiff_plain;h=605d693fa3417f9fb20ceeb6a295d7467e7cfd24;p=tahoe-lafs%2Ftahoe-lafs.git confwiz: reworked confwiz look and feel this changes the confwiz to have a look and feel much more consistent with that of the innosetup installer it is launched within the context of. this applies, naturally, primarily to windows. --- diff --git a/src/allmydata/gui/amdlogo.py b/src/allmydata/gui/amdlogo.py new file mode 100644 index 00000000..71456926 --- /dev/null +++ b/src/allmydata/gui/amdlogo.py @@ -0,0 +1,173 @@ +#---------------------------------------------------------------------- +# This file was generated by /opt/local/lib/python2.4/site-packages/wx-2.6-mac-unicode/wx/tools/img2py.py +# +from wx import ImageFromStream, BitmapFromImage +from wx import EmptyIcon +import cStringIO, zlib + + +def getData(): + return zlib.decompress( +'x\xda\x01\n\x0f\xf5\xf0\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x006\x00\ +\x00\x006\x08\x06\x00\x00\x00\x8cEj\xdd\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\ +\x08d\x88\x00\x00\x0e\xc1IDATh\x81\xbd\x9ai\x90\\Wu\xc7\x7f\xe7\xde\xb7\xf42\ +\xdd\xa3\x914\x92,\x8d$[\xdedIF62\x8b\xb0\xc16\xa0\x02C\xb1\x84J\xfc!T\xd9\ +\x15\x12Ha\x96PT\x92\xa2\x12 \xa4(Hp\x80\xa2\x1c\x8aP\x10\x92\x94M\x9cJ\x11\ +\x02$\x80C\x19\x8c\xcdb\xcb\x06\x83\xe5\x05!,dY\x8b5\xb24\x9a\x99\xee\xe9\ +\xe5\xdd\xf7\xee\xbd\xf9\xf0^\xcf\xa6\x91=\xd3\x92y]\xb7\xdf\xed\xb7\x9cw\ +\xfe\xf7\x7f\xce\xb9\xe7\xdc\xd7\xc2\x1d\xaf\xe4\x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01\xe7g\xe6\x0f\xef\xe7\x0c\ +\xb4\xf4z\x02\xd2\xfb\xd7\xac\xe4g\xe6\xc4\x1e\x99\x03J$wt\x11\x11z\xcd{\xe7\ +&Mbn\x90W}\xe9\xcd\x03/\xf9~X\x8d\x83J\xa5\x92V*\x95N\x1c\xc7SQ\x14M\x86a\ +\xd8\t\xc3\xb0\xa9\x94\x1a\xf7\xde\xfbi`\xb3\'\xb8\\\x98\x87\xbc\x9c\x8c\x9d\ +seA\xa241\xe1c\x13\x07\xd7g\xdeV\xc51d\xad\xad\xa7Y6`\x12S\xeb&\xddJ\x92$a\ +\x92\x18mR#i\x9ab3+\xd6fX\xe7\xe6\xc8W"(\xad\t\x82\x80 \x08|\x18\x86>\x8a"\ +\x17\xc7\xb1\x8d\xe38)\x94m*\xa5\xa6\xb4\xd6\xe3\x99\xb8F=\xa8\xb4/\x1f\xdax\ +\xc4k\xb1\xa2\xa4\x0bt\x94Rf\xb6\xee\xbd\x81\x008\r\xd8\xec\xbd\xf7y\xe6\xe0\ +\x9c#\x08\x02lf\tu\x98\x87\xc2\xccA\xa0f\x87\xfc*\x8e\xaa\xcf\xec\x80s\xae\ +\x92eY\xd9Z\x1b9\xe7\x94sN\x9cs\xd2{\xb8R\xca+\xa5\x9cR\xcaj\xad;A\x10t\x95\ +\xd6-D\x9ahZ\x90\xaf\x8ezc\x11\xa5 \x10|j\xb12W75\xaf\xacVJM\x03\xfb\x7f\xee\ +r\xc9\xfc\x835!h\x00\x00\x00\x00IEND\xaeB`\x82`\xcd|Q' ) + +def getBitmap(): + return BitmapFromImage(getImage()) + +def getImage(): + stream = cStringIO.StringIO(getData()) + return ImageFromStream(stream) + +def getIcon(): + icon = EmptyIcon() + icon.CopyFromBitmap(getBitmap()) + return icon + diff --git a/src/allmydata/gui/confwiz.py b/src/allmydata/gui/confwiz.py index c5a4c610..6ef06af9 100644 --- a/src/allmydata/gui/confwiz.py +++ b/src/allmydata/gui/confwiz.py @@ -22,7 +22,8 @@ from allmydata.util.assertutil import precondition from allmydata import uri import allmydata -import amdicon +#import amdicon +import amdlogo import foolscap from twisted.python import usage @@ -194,7 +195,7 @@ class ConfWizApp(wx.App): try: wx.InitAllImageHandlers() - self.login_frame = LoginFrame(self) + self.login_frame = WizardFrame(self, LoginPanel) self.login_frame.CenterOnScreen() self.SetTopWindow(self.login_frame) #self.SetExitOnFrameDelete(True) @@ -207,7 +208,7 @@ class ConfWizApp(wx.App): def swap_to_register_frame(self): try: self.login_frame.Show(False) - self.regiser_frame = RegisterFrame(self) + self.regiser_frame = WizardFrame(self, RegisterPanel) self.regiser_frame.CenterOnScreen() self.SetTopWindow(self.regiser_frame) self.SetExitOnFrameDelete(True) @@ -215,55 +216,48 @@ class ConfWizApp(wx.App): except: DisplayTraceback('config wizard threw an exception') -class LoginFrame(wx.Frame): - def __init__(self, app): - title = 'Allmydata Config Wizard' +class WizardFrame(wx.Frame): + def __init__(self, app, panel_class): + #title = 'Allmydata Config Wizard' + title = 'Setup - Allmydata 3.0' wx.Frame.__init__(self, None, -1, title) self.app = app - self.SetIcon(amdicon.getIcon()) + self.SetIcon(amdlogo.getIcon()) self.Bind(wx.EVT_CLOSE, self.close) - background = wx.Panel(self, -1) - background.SetSizeHints(500, 360, 600, 800) - background.parent = self - self.login_panel = LoginPanel(background, app) - self.reg_btn_panel = RegisterButtonPanel(background, app) - sizer = wx.BoxSizer(wx.VERTICAL) - background_sizer = wx.BoxSizer(wx.VERTICAL) - background_sizer.Add(wx.Size(2,2), 10, wx.EXPAND | wx.ALL, 26) - background_sizer.Add(self.login_panel, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 26) - background_sizer.Add(wx.Size(2,2), 10, wx.EXPAND | wx.ALL, 26) - background_sizer.Add(self.reg_btn_panel, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 26) - background.SetSizer(background_sizer) - sizer.Add(background, 0, wx.EXPAND | wx.ALL, 0) - self.SetSizer(sizer) - self.SetAutoLayout(True) - self.Fit() - self.Layout() + self.SetSizeHints(500, 360, 600, 800) - def close(self, event): - self.Show(False) - self.app.ExitMainLoop() + banner = wx.Panel(self, -1) + banner.SetSize((496,58)) + banner.SetBackgroundColour(wx.WHITE) + banner_label = wx.StaticText(banner, -1, 'Sign in to your account') -class RegisterFrame(wx.Frame): - def __init__(self, app): - title = 'Allmydata Config Wizard' - wx.Frame.__init__(self, None, -1, title) - self.app = app - self.SetIcon(amdicon.getIcon()) - self.Bind(wx.EVT_CLOSE, self.close) + banner_icon = wx.StaticBitmap(banner, -1, amdlogo.getBitmap()) - background = wx.Panel(self, -1) - background.SetSizeHints(500, 360, 600, 800) + banner_sizer = wx.BoxSizer(wx.HORIZONTAL) + banner_sizer.Add(banner_label, 1, wx.EXPAND | wx.ALL, 12) + banner_sizer.Add(banner_icon, 0, wx.ALL, 12) + banner.SetSizer(banner_sizer) + banner.SetAutoLayout(True) + + background = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) background.parent = self - self.register_panel = RegisterPanel(background, app) + + button_panel = wx.Panel(self, -1) + button_panel.SetSize((496, 64)) + + self.panel = panel_class(background, button_panel, app) sizer = wx.BoxSizer(wx.VERTICAL) background_sizer = wx.BoxSizer(wx.VERTICAL) - background_sizer.Add(wx.Size(2,2), 10, wx.EXPAND | wx.ALL, 26) - background_sizer.Add(self.register_panel, 0, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 26) - background_sizer.Add(wx.Size(2,2), 10, wx.EXPAND | wx.ALL, 26) + background_sizer.Add(wx.Size(2,2), 0, wx.EXPAND | wx.ALL, self.panel.padding) + background_sizer.Add(self.panel, 1, wx.ALIGN_CENTER_HORIZONTAL | wx.ALL, 26) + background_sizer.Add(wx.Size(2,2), 0, wx.EXPAND | wx.ALL, self.panel.padding) background.SetSizer(background_sizer) + + + sizer.Add(banner, 0, wx.EXPAND | wx.HORIZONTAL, 0) sizer.Add(background, 0, wx.EXPAND | wx.ALL, 0) + sizer.Add(button_panel, 0, wx.EXPAND | wx.HORIZONTAL, 0) self.SetSizer(sizer) self.SetAutoLayout(True) self.Fit() @@ -275,7 +269,9 @@ class RegisterFrame(wx.Frame): class LoginPanel(wx.Panel): - def __init__(self, parent, app): + padding = 26 + + def __init__(self, parent, button_panel, app): wx.Panel.__init__(self, parent, -1) self.parent = parent self.app = app @@ -286,24 +282,36 @@ class LoginPanel(wx.Panel): self.pass_label = wx.StaticText(self, -1, 'Password') self.user_field = wx.TextCtrl(self, -1, u'', size=(260,-1)) self.pass_field = wx.TextCtrl(self, -1, u'', size=(260,-1), style=wx.TE_PASSWORD) - self.login_button = wx.Button(self, -1, 'Sign In') self.warning_label = wx.StaticText(self, -1, '') self.warning_label.SetOwnForegroundColour(wx.RED) wx.EVT_CHAR(self.user_field, self.on_user_entry) wx.EVT_CHAR(self.pass_field, self.on_pass_entry) - self.Bind(wx.EVT_BUTTON, self.on_login, self.login_button) - login_sizer = wx.FlexGridSizer(3, 2, 5, 4) + login_sizer = wx.FlexGridSizer(2, 2, 5, 4) login_sizer.Add(self.user_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) login_sizer.Add(self.user_field, 0, wx.EXPAND | wx.ALL, 2) login_sizer.Add(self.pass_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) login_sizer.Add(self.pass_field, 0, wx.EXPAND | wx.ALL, 2) - login_sizer.Add(wx.Size(2,2), 0, wx.ALIGN_RIGHT | wx.ALL, 2) - login_sizer.Add(self.login_button, 0, wx.ALIGN_RIGHT | wx.ALL, 2) self.sizer.Add(login_sizer, 1, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.warning_label, 0, wx.CENTER | wx.ALL, 2) self.SetSizer(self.sizer) self.SetAutoLayout(True) + self.reg_label = wx.StaticText(button_panel, -1, "Don't have an account?") + self.reg_button = wx.Button(button_panel, -1, 'Create Account') + self.login_button = wx.Button(button_panel, -1, 'Sign In') + button_panel.Bind(wx.EVT_BUTTON, self.on_reg_button, self.reg_button) + button_panel.Bind(wx.EVT_BUTTON, self.on_login, self.login_button) + btn_sizer = wx.BoxSizer(wx.HORIZONTAL) + btn_sizer.Add(wx.Size(2,2), 1, wx.EXPAND | wx.ALL, 12) + btn_sizer.Add(self.reg_label, 0, wx.ALIGN_RIGHT | wx.ALL, 12) + btn_sizer.Add(self.reg_button, 0, wx.ALIGN_RIGHT | wx.ALL, 12) + btn_sizer.Add(self.login_button, 0, wx.ALIGN_RIGHT | wx.ALL, 12) + button_panel.SetSizer(btn_sizer) + self.button_panel = button_panel + + def on_reg_button(self, event): + self.app.swap_to_register_frame() + def on_user_entry(self, event): if event.GetKeyCode() == wx.WXK_RETURN: self.pass_field.SetFocus() @@ -356,29 +364,10 @@ class LoginPanel(wx.Panel): # exit self.parent.parent.Close() -class RegisterButtonPanel(wx.Panel): - def __init__(self, parent, app): - wx.Panel.__init__(self, parent, -1) - self.parent = parent - self.app = app - - self.sizer = wx.BoxSizer(wx.VERTICAL) - - self.reg_label = wx.StaticText(self, -1, "Don't have an account?") - self.reg_button = wx.Button(self, -1, 'Create Account') - self.Bind(wx.EVT_BUTTON, self.on_reg_button, self.reg_button) - reg_sizer = wx.FlexGridSizer(1, 2, 5, 4) - reg_sizer.Add(self.reg_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) - reg_sizer.Add(self.reg_button, 0, wx.ALIGN_RIGHT | wx.ALL, 2) - self.sizer.Add(reg_sizer, 1, wx.EXPAND | wx.ALL, 2) - self.SetSizer(self.sizer) - self.SetAutoLayout(True) - - def on_reg_button(self, event): - self.app.swap_to_register_frame() - class RegisterPanel(wx.Panel): - def __init__(self, parent, app): + padding = 7 + + def __init__(self, parent, button_panel, app): wx.Panel.__init__(self, parent, -1) self.parent = parent self.app = app @@ -391,7 +380,6 @@ class RegisterPanel(wx.Panel): self.user_field = wx.TextCtrl(self, -1, u'', size=(260,-1)) self.pass_field = wx.TextCtrl(self, -1, u'', size=(260,-1), style=wx.TE_PASSWORD) self.conf_field = wx.TextCtrl(self, -1, u'', size=(260,-1), style=wx.TE_PASSWORD) - self.create_account_button = wx.Button(self, -1, 'Create Account') self.subscribe_box = wx.CheckBox(self, -1, 'Sign up for our Newsletter') self.subscribe_box.SetValue(True) self.warning_label = wx.StaticText(self, -1, '') @@ -399,8 +387,7 @@ class RegisterPanel(wx.Panel): wx.EVT_CHAR(self.user_field, self.on_user_entry) wx.EVT_CHAR(self.pass_field, self.on_pass_entry) wx.EVT_CHAR(self.conf_field, self.on_conf_entry) - self.Bind(wx.EVT_BUTTON, self.on_create_account, self.create_account_button) - login_sizer = wx.FlexGridSizer(4, 2, 5, 4) + login_sizer = wx.FlexGridSizer(3, 2, 5, 4) login_sizer.Add(self.user_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) login_sizer.Add(self.user_field, 0, wx.EXPAND | wx.ALL, 2) login_sizer.Add(self.pass_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) @@ -408,14 +395,23 @@ class RegisterPanel(wx.Panel): login_sizer.Add(self.conf_label, 0, wx.ALIGN_RIGHT | wx.ALL, 2) login_sizer.Add(self.conf_field, 0, wx.EXPAND | wx.ALL, 2) login_sizer.Add(wx.Size(2,2), 0, wx.ALIGN_RIGHT | wx.ALL, 2) - login_sizer.Add(self.create_account_button, 0, wx.ALIGN_RIGHT | wx.ALL, 2) - self.sizer.Add(login_sizer, 1, wx.EXPAND | wx.ALL, 2) + self.sizer.Add(login_sizer, 0, wx.EXPAND | wx.ALL, 2) self.sizer.Add(self.warning_label, 0, wx.CENTER | wx.ALL, 2) self.sizer.Add(wx.Size(2,2), 0, wx.EXPAND | wx.ALL, 4) self.sizer.Add(self.subscribe_box, 0, wx.CENTER | wx.ALL, 2) self.SetSizer(self.sizer) self.SetAutoLayout(True) + self.reg_button = wx.Button(button_panel, -1, 'Create Account') + button_panel.Bind(wx.EVT_BUTTON, self.on_create_account, self.reg_button) + btn_sizer = wx.BoxSizer(wx.HORIZONTAL) + btn_sizer.Add(wx.Size(2,2), 1, wx.EXPAND | wx.ALL, 12) + btn_sizer.Add(self.reg_button, 0, wx.ALIGN_RIGHT | wx.ALL, 12) + button_panel.SetSizer(btn_sizer) + self.button_panel = button_panel + + self.Fit() + def on_user_entry(self, event): if event.GetKeyCode() == wx.WXK_RETURN: self.pass_field.SetFocus()