|
@ -33,10 +33,14 @@ class AbstractFooter(wx.Panel): |
|
|
self.restart_button = None |
|
|
self.restart_button = None |
|
|
self.buttons = None |
|
|
self.buttons = None |
|
|
|
|
|
|
|
|
|
|
|
self.layouts = {} |
|
|
|
|
|
|
|
|
self._init_components() |
|
|
self._init_components() |
|
|
self._init_pages() |
|
|
self._init_pages() |
|
|
self._do_layout() |
|
|
self._do_layout() |
|
|
|
|
|
|
|
|
|
|
|
pub.subscribe(self.load_view, events.WINDOW_CHANGE) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def _init_components(self): |
|
|
def _init_components(self): |
|
|
self.cancel_button = self.button(i18n._('cancel'), wx.ID_CANCEL, event_id=int(events.WINDOW_CANCEL)) |
|
|
self.cancel_button = self.button(i18n._('cancel'), wx.ID_CANCEL, event_id=int(events.WINDOW_CANCEL)) |
|
@ -44,31 +48,46 @@ class AbstractFooter(wx.Panel): |
|
|
self.start_button = self.button(i18n._('start'), wx.ID_OK, event_id=int(events.WINDOW_START)) |
|
|
self.start_button = self.button(i18n._('start'), wx.ID_OK, event_id=int(events.WINDOW_START)) |
|
|
self.close_button = self.button(i18n._("close"), wx.ID_OK, event_id=int(events.WINDOW_CLOSE)) |
|
|
self.close_button = self.button(i18n._("close"), wx.ID_OK, event_id=int(events.WINDOW_CLOSE)) |
|
|
self.restart_button = self.button(i18n._('restart'), wx.ID_OK, event_id=int(events.WINDOW_RESTART)) |
|
|
self.restart_button = self.button(i18n._('restart'), wx.ID_OK, event_id=int(events.WINDOW_RESTART)) |
|
|
|
|
|
self.edit_button = self.button(i18n._('edit'), wx.ID_OK, event_id=int(events.WINDOW_EDIT)) |
|
|
|
|
|
|
|
|
self.running_animation = wx.animate.GIFAnimationCtrl(self, -1, image_repository.loader) |
|
|
self.running_animation = wx.animate.GIFAnimationCtrl(self, -1, image_repository.loader) |
|
|
|
|
|
|
|
|
self.buttons = [self.cancel_button, self.start_button, self.stop_button, self.close_button, self.restart_button] |
|
|
|
|
|
|
|
|
self.buttons = [self.cancel_button, self.start_button, self.stop_button, self.close_button, self.restart_button, self.edit_button] |
|
|
|
|
|
|
|
|
def _init_pages(self): |
|
|
def _init_pages(self): |
|
|
if self.restart_button.IsShown(): self.restart_button.Hide() |
|
|
|
|
|
if self.close_button.IsShown(): self.close_button.Hide() |
|
|
|
|
|
|
|
|
def config(): |
|
|
|
|
|
self.hide_all_buttons() |
|
|
|
|
|
self.cancel_button.Show() |
|
|
|
|
|
self.start_button.Show() |
|
|
|
|
|
self.running_animation.Stop() |
|
|
|
|
|
self.Layout() |
|
|
|
|
|
|
|
|
def PageOne(): |
|
|
|
|
|
self.cancel_button.Hide() |
|
|
|
|
|
self.start_button.Hide() |
|
|
|
|
|
|
|
|
def running(): |
|
|
|
|
|
self.hide_all_buttons() |
|
|
self.running_animation.Show() |
|
|
self.running_animation.Show() |
|
|
self.running_animation.Play() |
|
|
self.running_animation.Play() |
|
|
self.Layout() |
|
|
self.Layout() |
|
|
|
|
|
|
|
|
def PageTwo(): |
|
|
|
|
|
|
|
|
def success(): |
|
|
|
|
|
self.hide_all_buttons() |
|
|
self.running_animation.Stop() |
|
|
self.running_animation.Stop() |
|
|
self.running_animation.Hide() |
|
|
self.running_animation.Hide() |
|
|
|
|
|
self.edit_button.Show() |
|
|
self.restart_button.Show() |
|
|
self.restart_button.Show() |
|
|
self.close_button.Show() |
|
|
self.close_button.Show() |
|
|
self.restart_button.Show() |
|
|
|
|
|
self.Layout() |
|
|
self.Layout() |
|
|
|
|
|
|
|
|
self._pages = iter([PageOne, PageTwo]) |
|
|
|
|
|
|
|
|
def error(): |
|
|
|
|
|
success() |
|
|
|
|
|
|
|
|
|
|
|
self.layouts = locals() |
|
|
|
|
|
|
|
|
|
|
|
def load_view(self, view_name=None): |
|
|
|
|
|
self.layouts.get(view_name, lambda: None)() |
|
|
|
|
|
|
|
|
|
|
|
def hide_all_buttons(self): |
|
|
|
|
|
for button in self.buttons: |
|
|
|
|
|
button.Hide() |
|
|
|
|
|
|
|
|
def _do_layout(self): |
|
|
def _do_layout(self): |
|
|
self.stop_button.Hide() |
|
|
self.stop_button.Hide() |
|
@ -86,8 +105,10 @@ class AbstractFooter(wx.Panel): |
|
|
v_sizer.Add(self.running_animation, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 20) |
|
|
v_sizer.Add(self.running_animation, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 20) |
|
|
self.running_animation.Hide() |
|
|
self.running_animation.Hide() |
|
|
|
|
|
|
|
|
v_sizer.Add(self.restart_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 20) |
|
|
|
|
|
v_sizer.Add(self.close_button, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT | wx.RIGHT, 20) |
|
|
|
|
|
|
|
|
h_sizer.Add(self.edit_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10) |
|
|
|
|
|
h_sizer.Add(self.restart_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 10) |
|
|
|
|
|
h_sizer.Add(self.close_button, 0, wx.ALIGN_RIGHT | wx.RIGHT, 20) |
|
|
|
|
|
self.edit_button.Hide() |
|
|
self.restart_button.Hide() |
|
|
self.restart_button.Hide() |
|
|
self.close_button.Hide() |
|
|
self.close_button.Hide() |
|
|
|
|
|
|
|
@ -106,13 +127,6 @@ class AbstractFooter(wx.Panel): |
|
|
if self._controller is None: |
|
|
if self._controller is None: |
|
|
self._controller = controller |
|
|
self._controller = controller |
|
|
|
|
|
|
|
|
def NextPage(self): |
|
|
|
|
|
try: |
|
|
|
|
|
next(self._pages)() |
|
|
|
|
|
except: |
|
|
|
|
|
self._init_pages() |
|
|
|
|
|
next(self._pages)() |
|
|
|
|
|
|
|
|
|
|
|
def _load_image(self, img_path, height=70): |
|
|
def _load_image(self, img_path, height=70): |
|
|
return imageutil.resize_bitmap(self, imageutil._load_image(img_path), height) |
|
|
return imageutil.resize_bitmap(self, imageutil._load_image(img_path), height) |
|
|
|
|
|
|
|
|