Ejemplo n.º 1
0
    def _do_layout(self):
        sizer = wx.BoxSizer(wx.VERTICAL)
        sizer.Add(self.head_panel, 0, wx.EXPAND)
        sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)

        if self.build_spec['layout_type'] == 'column':
            self.config_panel = layouts.ColumnLayout(
                self, build_spec=self.build_spec)
            sizer.Add(self.config_panel, 1, wx.EXPAND)
        else:
            self.config_panel = layouts.FlatLayout(self,
                                                   build_spec=self.build_spec)
            sizer.Add(self.config_panel, 1, wx.EXPAND)

        sizer.Add(self.runtime_display, 1, wx.EXPAND)

        self.runtime_display.Hide()
        sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
        sizer.Add(self.foot_panel, 0, wx.EXPAND)
        self.SetSizer(sizer)

        self.sizer = sizer

        pub.subscribe(self.myListener, "panelListener")
        pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 2
0
    def __init__(self, parent):
        self.startTime = 0
        self.estimatedRemaining = None
        self.wxTimer = wx.Timer(parent)
        self.parent = parent
        parent.Bind(wx.EVT_TIMER, self.publishTime, self.wxTimer)

        pub.subscribe(events.PROGRESS_UPDATE, self._updateEstimate)
Ejemplo n.º 3
0
 def onComponentInitialized(self):
     self.widget.GetTextCtrl().Bind(wx.EVT_TEXT, self.onTextInput)
     self.widget.GetTextCtrl().Bind(wx.EVT_CHAR_HOOK, self.onKeyboardControls)
     self.widget.Bind(wx.EVT_LEFT_DOWN, notifyMouseEvent)
     self.widget.GetTextCtrl().Bind(wx.EVT_LEFT_DOWN, notifyMouseEvent)
     self.listbox.Bind(wx.EVT_LISTBOX, self.onClickSuggestion)
     pub.subscribe(events.LEFT_DOWN, self.onMouseClick)
     self.widget.SetHint(self._options.get('placeholder', ''))
Ejemplo n.º 4
0
    def __init__(self, base_frame, build_spec):
        '''
    :type base_frame: BaseWindow
    :type build_spec: dict
    '''
        self.core_gui = base_frame
        self.build_spec = build_spec

        # wire up all the observers
        pub.subscribe(self.on_cancel, events.WINDOW_CANCEL)
        pub.subscribe(self.on_start, events.WINDOW_START)
        pub.subscribe(self.on_restart, events.WINDOW_RESTART)
        pub.subscribe(self.on_close, events.WINDOW_CLOSE)
        pub.subscribe(self.on_edit, events.WINDOW_EDIT)
Ejemplo n.º 5
0
  def __init__(self, base_frame, build_spec):
    '''
    :type base_frame: BaseWindow
    :type build_spec: dict
    '''
    self.core_gui = base_frame
    self.build_spec = build_spec

    # wire up all the observers
    pub.subscribe(self.on_cancel,   events.WINDOW_CANCEL)
    pub.subscribe(self.on_start,    events.WINDOW_START)
    pub.subscribe(self.on_restart,  events.WINDOW_RESTART)
    pub.subscribe(self.on_close,    events.WINDOW_CLOSE)
    pub.subscribe(self.on_edit,     events.WINDOW_EDIT)
Ejemplo n.º 6
0
    def __init__(self, app):
        self.model = Model()

        #set up the first frame which displays the current Model value
        self.view1 = View(None)
        self.view1.SetMoney(self.model.myMoney)

        #set up the second frame which allows the user to modify the Model's value
        self.view2 = ChangerWidget(self.view1)
        self.view2.add.Bind(wx.EVT_BUTTON, self.AddMoney)
        self.view2.remove.Bind(wx.EVT_BUTTON, self.RemoveMoney)
        #subscribe to all "MONEY CHANGED" messages from the Model
        #to subscribe to ALL messages (topics), omit the second argument below
        pub.subscribe(self.MoneyChanged, "MONEY CHANGED")

        self.view1.Show()
        self.view2.Show()
Ejemplo n.º 7
0
  def __init__(self, *args, **kwargs):
    self._build_spec = kwargs.pop('build_spec')
    super(ColumnLayout, self).__init__(*args, **kwargs)
    self.SetDoubleBuffered(True)

    self.sidebar = Sidebar(self, contents=self._build_spec['widgets'].keys())

    self.config_panels = self.build_panels(self._build_spec)
    self.active_panel = self.config_panels.keys()[0]
    self.config_panels[self.active_panel].Show()

    sizer = wx.BoxSizer(wx.HORIZONTAL)
    sizer.Add(self.sidebar, 1, wx.EXPAND)
    sizer.Add(wx_util.vertical_rule(self), 0, wx.EXPAND)
    for panel in self.config_panels.values():
      sizer.Add(panel, 3, wx.EXPAND)
    self.SetSizer(sizer)

    pub.subscribe(self.load_view,   events.PANEL_CHANGE)
Ejemplo n.º 8
0
  def __init__(self, *args, **kwargs):
    self._build_spec = kwargs.pop('build_spec')
    super(ColumnLayout, self).__init__(*args, **kwargs)
    self.SetDoubleBuffered(True)

    self.sidebar = Sidebar(self, contents=self._build_spec['widgets'].keys())

    self.config_panels = self.build_panels(self._build_spec)
    self.active_panel = self.config_panels.keys()[0]
    self.config_panels[self.active_panel].Show()

    sizer = wx.BoxSizer(wx.HORIZONTAL)
    sizer.Add(self.sidebar, 1, wx.EXPAND)
    sizer.Add(wx_util.vertical_rule(self), 0, wx.EXPAND)
    for panel in self.config_panels.values():
      sizer.Add(panel, 3, wx.EXPAND)
    self.SetSizer(sizer)

    pub.subscribe(self.load_view,   events.PANEL_CHANGE)
Ejemplo n.º 9
0
  def __init__(self, parent, **kwargs):
    wx.Panel.__init__(self, parent, **kwargs)
    self.SetMinSize((30, 53))

    self._controller = None

    # components
    self.cancel_button = None
    self.start_button = None
    self.running_animation = None
    self.close_button = None
    self.stop_button = None
    self.restart_button = None
    self.buttons = None

    self.layouts = {}

    self._init_components()
    self._init_pages()
    self._do_layout()

    pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 10
0
    def __init__(self, parent, **kwargs):
        wx.Panel.__init__(self, parent, **kwargs)
        self.SetMinSize((30, 53))

        self._controller = None

        # components
        self.cancel_button = None
        self.start_button = None
        self.running_animation = None
        self.close_button = None
        self.stop_button = None
        self.restart_button = None
        self.buttons = None

        self.layouts = {}

        self._init_components()
        self._init_pages()
        self._do_layout()

        pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 11
0
  def _do_layout(self):
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(self.head_panel, 0, wx.EXPAND)
    sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)

    if self.build_spec['layout_type'] == 'column':
      self.config_panel = layouts.ColumnLayout(self, build_spec=self.build_spec)
      sizer.Add(self.config_panel, 1, wx.EXPAND)
    else:
      self.config_panel = layouts.FlatLayout(self, build_spec=self.build_spec)
      sizer.Add(self.config_panel, 1, wx.EXPAND)

    sizer.Add(self.runtime_display, 1, wx.EXPAND)

    self.runtime_display.Hide()
    sizer.Add(wx_util.horizontal_rule(self), 0, wx.EXPAND)
    sizer.Add(self.foot_panel, 0, wx.EXPAND)
    self.SetSizer(sizer)

    self.sizer = sizer

    pub.subscribe(self.myListener, "panelListener")
    pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 12
0
  def __init__(self, heading, subheading, **kwargs):
    wx.Panel.__init__(self, **kwargs)
    self.SetDoubleBuffered(True)
    self._controller = None

    self.heading_msg = heading
    self.subheading_msg = subheading

    self._header = None
    self._subheader = None
    self._settings_img = None
    self._running_img = None
    self._check_mark = None
    self._error_symbol = None

    self.layouts = {}

    self._init_properties()
    self._init_components(heading, subheading)
    self._init_pages()
    self._do_layout()

    pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 13
0
    def __init__(self, heading, subheading, **kwargs):
        wx.Panel.__init__(self, **kwargs)
        self.SetDoubleBuffered(True)
        self._controller = None

        self.heading_msg = heading
        self.subheading_msg = subheading

        self._header = None
        self._subheader = None
        self._settings_img = None
        self._running_img = None
        self._check_mark = None
        self._error_symbol = None

        self.layouts = {}

        self._init_properties()
        self._init_components(heading, subheading)
        self._init_pages()
        self._do_layout()

        pub.subscribe(self.load_view, events.WINDOW_CHANGE)
Ejemplo n.º 14
0
  def __init__(self, view, model):
    self.view = view
    self.model = model

    self.client_runner = ProcessController(
      self.model.progress_regex,
      self.model.progress_expr
    )

    pub.subscribe(self.on_cancel, events.WINDOW_CANCEL)
    pub.subscribe(self.on_stop, events.WINDOW_STOP)
    pub.subscribe(self.on_start, events.WINDOW_START)
    pub.subscribe(self.on_restart,  events.WINDOW_RESTART)
    pub.subscribe(self.on_edit, events.WINDOW_EDIT)
    pub.subscribe(self.on_close, events.WINDOW_CLOSE)

    # console statuses from the other thread
    pub.subscribe(self.on_new_message, 'console_update')
    pub.subscribe(self.on_progress_change, 'progress_update')
    pub.subscribe(self.on_client_done, 'execution_complete')


    pub.subscribe(self.on_selection_change, events.LIST_BOX)
Ejemplo n.º 15
0
    def component_did_mount(self):
        pub.subscribe(events.WINDOW_START, self.onStart)
        pub.subscribe(events.WINDOW_RESTART, self.onStart)
        pub.subscribe(events.WINDOW_STOP, self.handleInterrupt)
        pub.subscribe(events.WINDOW_CLOSE, self.handleClose)
        pub.subscribe(events.WINDOW_CANCEL, self.handleCancel)
        pub.subscribe(events.WINDOW_EDIT, self.handleEdit)
        pub.subscribe(events.CONSOLE_UPDATE,
                      self.consoleRef.instance.logOutput)
        pub.subscribe(events.EXECUTION_COMPLETE, self.handleComplete)
        pub.subscribe(events.PROGRESS_UPDATE, self.updateProgressBar)
        pub.subscribe(events.TIME_UPDATE, self.updateTime)
        # # Top level wx close event
        frame: wx.Frame = self.frameRef.instance
        frame.Bind(wx.EVT_CLOSE, self.handleClose)
        frame.SetMenuBar(MenuBar(self.buildSpec))
        self.timer = Timing(frame)

        if self.state['fullscreen']:
            frame.ShowFullScreen(True)

        if self.state[
                'show_preview_warning'] and not 'unittest' in sys.modules.keys(
                ):
            wx.MessageDialog(None,
                             caption='YOU CAN DISABLE THIS MESSAGE',
                             message="""
                This is a preview build of 1.2.0! There may be instability or 
                broken functionality. If you encounter any issues, please open an issue 
                here: https://github.com/chriskiehl/Gooey/issues 
                
                The current stable version is 1.0.8. 
                
                NOTE! You can disable this message by setting `show_preview_warning` to False. 
                
                e.g. 
                `@Gooey(show_preview_warning=False)`
                """).ShowModal()
Ejemplo n.º 16
0
    def __init__(self, view, model):
        self.view = view
        self.model = model

        self.client_runner = ProcessController(self.model.progress_regex,
                                               self.model.progress_expr)

        pub.subscribe(self.on_cancel, events.WINDOW_CANCEL)
        pub.subscribe(self.on_stop, events.WINDOW_STOP)
        pub.subscribe(self.on_start, events.WINDOW_START)
        pub.subscribe(self.on_restart, events.WINDOW_RESTART)
        pub.subscribe(self.on_edit, events.WINDOW_EDIT)
        pub.subscribe(self.on_close, events.WINDOW_CLOSE)

        # console statuses from the other thread
        pub.subscribe(self.on_new_message, 'console_update')
        pub.subscribe(self.on_progress_change, 'progress_update')
        pub.subscribe(self.on_client_done, 'execution_complete')

        pub.subscribe(self.on_selection_change, events.LIST_BOX)
Ejemplo n.º 17
0
    def __init__(self, buildSpec, *args, **kwargs):
        super(GooeyApplication, self).__init__(None, *args, **kwargs)
        self._state = {}
        self.buildSpec = buildSpec

        self.header = FrameHeader(self, buildSpec)
        self.configs = self.buildConfigPanels(self)
        self.navbar = self.buildNavigation()
        self.footer = Footer(self, buildSpec)
        self.console = Console(self, buildSpec)
        self.layoutComponent()

        self.clientRunner = ProcessController(
            self.buildSpec.get('progress_regex'),
            self.buildSpec.get('progress_expr'),
            self.buildSpec.get('encoding')
        )

        pub.subscribe(events.WINDOW_START, self.onStart)
        pub.subscribe(events.WINDOW_RESTART, self.onStart)
        pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
        pub.subscribe(events.WINDOW_CLOSE, self.onClose)
        pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
        pub.subscribe(events.WINDOW_EDIT, self.onEdit)
        pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
        pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
        pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
        # Top level wx close event
        self.Bind(wx.EVT_CLOSE, self.onClose)

        if self.buildSpec['poll_external_updates']:
            self.fetchExternalUpdates()

        if self.buildSpec.get('auto_start', False):
            self.onStart()
Ejemplo n.º 18
0
    def __init__(self, buildSpec, *args, **kwargs):
        super(GooeyApplication, self).__init__(None, *args, **kwargs)
        self._state = {}
        self.buildSpec = buildSpec

        self.applyConfiguration()
        self.menu = MenuBar(buildSpec)
        self.SetMenuBar(self.menu)
        self.header = FrameHeader(self, buildSpec)
        self.configs = self.buildConfigPanels(self)
        self.navbar = self.buildNavigation()
        self.footer = Footer(self, buildSpec)
        self.console = Console(self, buildSpec)

        self.props = {
            'background_color': self.buildSpec['header_bg_color'],
            'title': self.buildSpec['program_name'],
            'subtitle': self.buildSpec['program_description'],
            'height': self.buildSpec['header_height'],
            'image_uri': self.buildSpec['images']['configIcon'],
            'image_size': (six.MAXSIZE, self.buildSpec['header_height'] - 10)
        }

        state = form_page(initial_state(self.buildSpec))

        self.fprops = {
            'buttons': state['buttons'],
            'progress': state['progress'],
            'timing': state['timing'],
            'bg_color': self.buildSpec['footer_bg_color']
        }

        # self.hhh = render(create_element(RHeader, self.props), self)
        # self.fff = render(create_element(RFooter, self.fprops), self)
        # patch(self.hhh, create_element(RHeader, {**self.props, 'image_uri': self.buildSpec['images']['runningIcon']}))
        self.layoutComponent()
        self.timer = Timing(self)

        self.clientRunner = ProcessController(
            self.buildSpec.get('progress_regex'),
            self.buildSpec.get('progress_expr'),
            self.buildSpec.get('hide_progress_msg'),
            self.buildSpec.get('encoding'),
            self.buildSpec.get('requires_shell'),
            self.buildSpec.get('shutdown_signal', signal.SIGTERM))

        pub.subscribe(events.WINDOW_START, self.onStart)
        pub.subscribe(events.WINDOW_RESTART, self.onStart)
        pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
        pub.subscribe(events.WINDOW_CLOSE, self.onClose)
        pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
        pub.subscribe(events.WINDOW_EDIT, self.onEdit)
        pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
        pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
        pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
        pub.subscribe(events.TIME_UPDATE, self.footer.updateTimeRemaining)
        # Top level wx close event
        # self.Bind(wx.EVT_CLOSE, self.onClose)

        # TODO: handle child focus for per-field level validation.
        # self.Bind(wx.EVT_CHILD_FOCUS, self.handleFocus)

        if self.buildSpec.get('auto_start', False):
            self.onStart()
Ejemplo n.º 19
0
    def __init__(self, buildSpec, *args, **kwargs):
        super(GooeyApplication, self).__init__(None, *args, **kwargs)
        self._state = {}
        self.buildSpec = buildSpec

        self.header = FrameHeader(self, buildSpec)
        self.configs = self.buildConfigPanels(self)
        self.navbar = self.buildNavigation()
        self.footer = Footer(self, buildSpec)
        self.console = Console(self, buildSpec)
        self.layoutComponent()

        self.clientRunner = ProcessController(
            self.buildSpec.get('progress_regex'),
            self.buildSpec.get('progress_expr'),
            self.buildSpec.get('encoding'))

        pub.subscribe(events.WINDOW_START, self.onStart)
        pub.subscribe(events.WINDOW_RESTART, self.onStart)
        pub.subscribe(events.WINDOW_STOP, self.onStopExecution)
        pub.subscribe(events.WINDOW_CLOSE, self.onClose)
        pub.subscribe(events.WINDOW_CANCEL, self.onCancel)
        pub.subscribe(events.WINDOW_EDIT, self.onEdit)
        pub.subscribe(events.CONSOLE_UPDATE, self.console.logOutput)
        pub.subscribe(events.EXECUTION_COMPLETE, self.onComplete)
        pub.subscribe(events.PROGRESS_UPDATE, self.footer.updateProgressBar)
        # Top level wx close event
        self.Bind(wx.EVT_CLOSE, self.onClose)

        if self.buildSpec['poll_external_updates']:
            self.fetchExternalUpdates()

        if self.buildSpec.get('auto_start', False):
            self.onStart()