Пример #1
0
    def set_focus (self, focus=True):
        """E.set_focus (...) -> bool
        
        Sets the input and action focus of the Editable.
        
        Sets the input and action focus of the Editable and returns True
        upon success or False, if the focus could not be set.

        Note: This method only works as supposed using
        a render loop, which supports the Renderer class specification.
        """
        if not self.sensitive:
            return False
        
        BaseWidget.set_focus (self, focus)
        if focus:
            # Save the text after activation and reset the caret blink
            # effects.
            self._caret_visible = True
            self._temp = self.text
            self._caret_visible = True
            self._counter = 0
            self.state = STATE_ACTIVE
        elif self._temp != self.text:
            # If the Editable looses its input focus _and_ has changed text,
            # it will be validated by default.
            if base.debug: print "Editable.INPUT"
            self._temp = self.text
            self.state = STATE_NORMAL
            self.run_signal_handlers (SIG_INPUT)
        else:
            # The Editable looses its input focus without any change.
            self.state = STATE_NORMAL
            self._caret = 0
        return True
Пример #2
0
    def set_focus(self, focus=True):
        """E.set_focus (...) -> bool
        
        Sets the input and action focus of the Editable.
        
        Sets the input and action focus of the Editable and returns True
        upon success or False, if the focus could not be set.

        Note: This method only works as supposed using
        a render loop, which supports the Renderer class specification.
        """
        if not self.sensitive:
            return False

        if focus:
            # Save the text after activation and reset the caret blink
            # effects.
            self._set_caret_visible(True)
            self._temp = self.text
            self._caretvisible = True
            self._timer = _TIMER
            self.state = STATE_ACTIVE
        elif self._temp != self.text:
            # If the Editable looses its input focus _and_ has changed text,
            # it will be validated by default.
            self._temp = self.text
            self.state = STATE_NORMAL
            self.run_signal_handlers(SIG_INPUT)
        else:
            # The Editable looses its input focus without any change.
            self.state = STATE_NORMAL
        BaseWidget.set_focus(self, focus)
        return True
Пример #3
0
	def __init__( self, parent ):
		BaseWidget.__init__ ( self, parent )

		self.m_mainSizer = wx.BoxSizer( wx.VERTICAL )

		m_errorMsgSizer = wx.BoxSizer( wx.VERTICAL )

		self.m_errorLabel = wx.StaticText( self, wx.ID_ANY, u"Error Message", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_errorLabel.Wrap( -1 )
		m_errorMsgSizer.Add( self.m_errorLabel, 0, wx.TOP|wx.RIGHT|wx.LEFT, 5 )

		self.m_errorMsgCtrl = wx.richtext.RichTextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS )
		m_errorMsgSizer.Add( self.m_errorMsgCtrl, 1, wx.EXPAND |wx.ALL, 5 )

		self.m_mainSizer.Add( m_errorMsgSizer, 1, wx.EXPAND, 5 )

		m_diagnosticSizer = wx.BoxSizer( wx.VERTICAL )

		self.m_diagnosticLabel = wx.StaticText( self, wx.ID_ANY, u"Diagnostics", wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_diagnosticLabel.Wrap( -1 )
		m_diagnosticSizer.Add( self.m_diagnosticLabel, 0, wx.TOP|wx.RIGHT|wx.LEFT, 5 )

		self.m_diagnosticCtrl = wx.richtext.RichTextCtrl( self, wx.ID_ANY, wx.EmptyString, wx.DefaultPosition, wx.DefaultSize, 0|wx.VSCROLL|wx.HSCROLL|wx.NO_BORDER|wx.WANTS_CHARS )
		m_diagnosticSizer.Add( self.m_diagnosticCtrl, 1, wx.EXPAND |wx.ALL, 5 )

		self.m_mainSizer.Add( m_diagnosticSizer, 2, wx.EXPAND, 5 )

		self.initButtons( [Globals.ButtonTypes.NETWORK_LOG] )

		self.SetSizer( self.m_mainSizer )
		self.Layout()
Пример #4
0
    def update(self, **kwargs):
        """C.update (...) -> None

        Updates the Container and refreshes its image and rect content.

        Updates the Container and causes its parent to update itself on
        demand.
        """
        children = kwargs.get("children", {})
        resize = kwargs.get("resize", False)

        # We have to check for possible size changes here!
        if resize:
            self.dirty = True
        elif self.locked:
            return
        else:
            # Get the intersections with other overlapping children and add
            # them to the update list.
            items = children.items()
            ch = self.children
            for w, rect in items:
                for widget in ch:
                    if w == widget:
                        continue
                    intersect = widget.rect.clip(rect)
                    if intersect.size != (0, 0):
                        children[widget] = intersect
            BaseWidget.update(self, children=children, resize=resize)
Пример #5
0
    def update(self, **kwargs):
        """C.update (...) -> None

        Updates the Container and refreshes its image and rect content.

        Updates the Container and causes its parent to update itself on
        demand.
        """
        children = kwargs.get("children", {})
        resize = kwargs.get("resize", False)

        # We have to check for possible size changes here!
        if resize:
            self.dirty = True
        elif self.locked:
            return
        else:
            # Get the intersections with other overlapping children and add
            # them to the update list.
            items = children.items()
            ch = self.children
            for w, rect in items:
                for widget in ch:
                    if w == widget:
                        continue
                    intersect = widget.rect.clip(rect)
                    if intersect.size != (0, 0):
                        children[widget] = intersect
            BaseWidget.update(self, children=children, resize=resize)
Пример #6
0
    def notify (self, event):
        """E.notify (...) -> None

        Notifies the Editable about an event.
        """
        if not self.sensitive:
            return

        # The next few events are only available, if the entry is focused.
        if self.focus:
            # Blinking caret.
            # TODO: TICK events are not the best idea to use here.
            if event.signal == SIG_TICK:
                if self._counter == 50:
                    self._caret_visible = not self._caret_visible
                    self._counter = 0
                    self.dirty = True
                self._counter += 1
            
            elif event.signal == SIG_KEYDOWN:
                if base.debug: print "Editable.KEYDOWN"
                self.run_signal_handlers (SIG_KEYDOWN, event.data)
                self._input (event.data)
                self._counter = 0
                self._caret_visible= True

        BaseWidget.notify (self, event)
Пример #7
0
    def __init__(self, lines, characters, y, x, resultsObj=None, colWidth=7, rowHeight=1, delimiter=" | "):
        BaseWidget.__init__(self, lines, characters, y, x)
        
        # position of the selector in DataTable
        self.PosY = 0                   # row
        self.PosX = 0                   # col
        
        # DataTable UI Settings independent of Results Object
        # Can update these as we choose for each DataTable Widget
        if colWidth < 4:
            self.ColWidth = 4
        else:
            self.ColWidth = colWidth               # Width of each column, update as desired
        if rowHeight < 1:
            self.RowHeight = 1
        else:
            self.RowHeight = rowHeight              # Height of each row, update as desired
        if delimiter == "":
            self.ColumnDelimiter = " | "
        else:
            self.ColumnDelimiter = delimiter    # Delimiter string between each column's data, update as desired
        
        # variables that govern table data
        # these are base values to show an empty data table
        # LoadResultsObject() will overwrite these with resultsObj data
        self.Rows = 10
        self.Columns = 10
        self.RowLabelWidth = 2

        # load data from resultsObj to be displayed
        self.LoadResultsObject(resultsObj)    # must be called upon init to set graphics for widget
        self.UpdateDisplay()
Пример #8
0
 def __init__(self, checked_text, unchecked_text, height, width, y, x, attr=None):
     BaseWidget.__init__(self, height, width, y, x, attr)
     self.CheckedText = "< " + checked_text + " >"
     self.UncheckedText = "< " + unchecked_text + " >"
     self.Text = self.UncheckedText
     self.Checked = False
     self.UpdateDisplay()
Пример #9
0
    def set_sensitive(self, sensitive=True):
        """C.set_sensitive (...) -> None

        Sets the sensitivity of the Container and its children.
        """
        BaseWidget.set_sensitive(self, sensitive)
        for child in self.children:
            child.set_sensitive(sensitive)
Пример #10
0
    def __init__ (self, image):
        BaseWidget.__init__ (self)

        self._padding = 2
        self._border = BORDER_NONE
        self._picture = None
        self._path = None
        self.set_picture (image)
Пример #11
0
    def __init__(self, image):
        BaseWidget.__init__(self)

        self._padding = 2
        self._border = BORDER_NONE
        self._picture = None
        self._path = None
        self.set_picture(image)
Пример #12
0
    def set_sensitive(self, sensitive=True):
        """C.set_sensitive (...) -> None

        Sets the sensitivity of the Container and its children.
        """
        BaseWidget.set_sensitive(self, sensitive)
        for child in self.children:
            child.set_sensitive(sensitive)
Пример #13
0
 def __init__(self, height, width, y, x, attr=None):
     BaseWidget.__init__(self, height, width, y, x, attr)
     self.Type = "TextBox"
     self.Text = ""
     self.DisplayText = ' ' * (width - 1)
     self.DisplayMode = "STANDARD"
     self.IsActive = False
     self.UpdateDisplay()
Пример #14
0
    def set_sensitive (self, sensitive=True):
        """B.set_sensitive (...) -> None

        Sets the sensitivity of the Bin and its child.
        """
        BaseWidget.set_sensitive (self, sensitive)
        if self.child:
            self.child.set_sensitive (sensitive)
Пример #15
0
    def __init__ (self, scrolledlist):
        BaseWidget.__init__ (self)
        self._itemcollection = None
        self.itemcollection = ListItemCollection ()
        self.scrolledlist = scrolledlist
        self._spacing = 2

        self._signals[SIG_MOUSEDOWN] = []
        self._signals[SIG_KEYDOWN] = None # Dummy for keyboard activation.
Пример #16
0
    def draw(self):
        """I.draw () -> None

        Draws the ImageMap surface and places its picture on it.
        """
        BaseWidget.draw(self)
        rect = self.picture.get_rect()
        rect.center = self.image.get_rect().center
        self.image.blit(self.picture, rect)
Пример #17
0
    def draw (self):
        """I.draw () -> None

        Draws the ImageMap surface and places its picture on it.
        """
        BaseWidget.draw (self)
        rect = self.picture.get_rect ()
        rect.center = self.image.get_rect ().center
        self.image.blit (self.picture, rect)
Пример #18
0
    def __init__ (self):
        BaseWidget.__init__ (self)
        self.size = 104, 24 # Use a fixed size.

        # The current value, max is 100 (%), min is 0 (%) and step range.
        self._value = 0
        self._step = 0.1 

        self._text = None
        self._signals[SIG_VALCHANGE] = []
Пример #19
0
    def set_sensitive(self, sensitive=True):
        """B.set_sensitive (...) -> None

        Sets the sensitivity of the Bin and its child.
        """
        self.lock()
        BaseWidget.set_sensitive(self, sensitive)
        if self.child:
            self.child.set_sensitive(sensitive)
        self.unlock()
Пример #20
0
    def set_event_manager(self, manager):
        """B.set_event_manager (...) -> None

        Sets the event manager of the Bin.

        Adds the Bin to an event manager and causes its child to be
        added to the same, too.
        """
        BaseWidget.set_event_manager(self, manager)
        if self.child:
            self.child.set_event_manager(manager)
Пример #21
0
    def set_event_manager (self, manager):
        """B.set_event_manager (...) -> None

        Sets the event manager of the Bin.

        Adds the Bin to an event manager and causes its child to be
        added to the same, too.
        """
        BaseWidget.set_event_manager (self, manager)
        if self.child:
            self.child.set_event_manager (manager)
Пример #22
0
    def set_indexable(self, indexable):
        """C.set_indexable (...) -> None

        Sets the indexable of the Container.

        Adds the Container to an IIndexable implementation and causes its
        children to be added to the same, too.
        """
        BaseWidget.set_indexable(self, indexable)
        for child in self.children:
            child.set_indexable(indexable)
Пример #23
0
    def set_indexable(self, indexable):
        """C.set_indexable (...) -> None

        Sets the indexable of the Container.

        Adds the Container to an IIndexable implementation and causes its
        children to be added to the same, too.
        """
        BaseWidget.set_indexable(self, indexable)
        for child in self.children:
            child.set_indexable(indexable)
Пример #24
0
    def set_event_manager(self, manager):
        """C.set_event_manager (...) -> None

        Sets the event manager of the Container.

        Adds the Container to an event manager and causes its children
        to be added to the same, too.
        """
        BaseWidget.set_event_manager(self, manager)
        for child in self.children:
            child.set_event_manager(manager)
Пример #25
0
    def set_indexable(self, indexable):
        """B.set_indexable (...) -> None

        Sets the indexable of the Bin.

        Adds the Bin to an IIndexable implementation and causes its child
        to be added to the same, too.
        """
        BaseWidget.set_indexable(self, indexable)
        if self.child:
            self.child.set_indexable(indexable)
Пример #26
0
    def __init__(self):
        BaseWidget.__init__(self)

        # The current value, max is 100 (%), min is 0 (%) and step range.
        self._value = 0
        self._step = 0.1

        self._text = None
        self._signals[SIG_VALCHANGED] = []

        self.minsize = 104, 24  # Use a fixed size.
Пример #27
0
    def set_event_manager(self, manager):
        """C.set_event_manager (...) -> None

        Sets the event manager of the Container.

        Adds the Container to an event manager and causes its children
        to be added to the same, too.
        """
        BaseWidget.set_event_manager(self, manager)
        for child in self.children:
            child.set_event_manager(manager)
Пример #28
0
    def set_indexable (self, indexable):
        """B.set_indexable (...) -> None

        Sets the indexable of the Bin.

        Adds the Bin to an IIndexable implementation and causes its child
        to be added to the same, too.
        """
        BaseWidget.set_indexable (self, indexable)
        if self.child:
            self.child.set_indexable (indexable)
Пример #29
0
	def __init__( self, parent ):
		BaseWidget.__init__ ( self, parent )

		self.m_mainSizer = wx.BoxSizer( wx.VERTICAL )

		self.m_bitmapHolder = wx.StaticBitmap( self, wx.ID_ANY, wx.NullBitmap, wx.DefaultPosition, wx.DefaultSize, 0 )
		self.m_mainSizer.Add( self.m_bitmapHolder, 1, wx.ALL|wx.EXPAND, 5 )

		self.initButtons( [Globals.ButtonTypes.OLD, Globals.ButtonTypes.NEW, Globals.ButtonTypes.DIFF, Globals.ButtonTypes.UPDATE] )

		self.SetSizer( self.m_mainSizer )
		self.Layout()
Пример #30
0
    def destroy (self):
        """B.destroy () -> None

        Destroys the Bin and removes it from its event system.
        """
        if self.child:
            w = self.child
            w.parent = None
            self.child = None
            w.destroy ()
            del w
        BaseWidget.destroy (self)
Пример #31
0
    def set_depth (self, depth):
        """B.set_depth (...) -> None

        Sets the depth of the Bin.

        Sets the depth of the Bin and its child to the given value.
        """
        self.lock ()
        BaseWidget.set_depth (self, depth)
        if self.child:
            self.child.set_depth (depth)
        self.unlock ()
Пример #32
0
    def destroy(self):
        """B.destroy () -> None

        Destroys the Bin and removes it from its event system.
        """
        if self.child:
            w = self.child
            w.parent = None
            self.child = None
            w.destroy()
            del w
        BaseWidget.destroy(self)
Пример #33
0
    def __init__ (self, text):
        BaseWidget.__init__ (self)

        # Mnemonic identifiers in a tuple: (index, key).
        self._mnemonic = (-1, None)
        self._widget = None
        self.__active = False # Internal mnemonic handler.
        
        self._text = None
        self.set_text (text)
        
        self._padding = 2
Пример #34
0
    def draw(self):
        """P.draw () -> None

        Draws the ProgressBar surface and places its text on it.
        """
        BaseWidget.draw(self)
        if self.text:
            sf_text = base.GlobalStyle.engine.draw_string(
                self.text, self.state, self.__class__, self.style)
            rect = sf_text.get_rect()
            rect.center = self.image.get_rect().center
            self.image.blit(sf_text, rect)
Пример #35
0
    def set_depth(self, depth):
        """B.set_depth (...) -> None

        Sets the depth of the Bin.

        Sets the depth of the Bin and its child to the given value.
        """
        self.lock()
        BaseWidget.set_depth(self, depth)
        if self.child:
            self.child.set_depth(depth)
        self.unlock()
Пример #36
0
    def set_depth(self, depth):
        """C.set_depth (...) -> None

        Sets the depth of the Container.

        Sets the depth of the Container and its children to the given
        value.
        """
        self.lock()
        BaseWidget.set_depth(self, depth)
        for child in self.children:
            child.set_depth(depth)
        self.unlock()
Пример #37
0
    def set_depth(self, depth):
        """C.set_depth (...) -> None

        Sets the depth of the Container.

        Sets the depth of the Container and its children to the given
        value.
        """
        self.lock()
        BaseWidget.set_depth(self, depth)
        for child in self.children:
            child.set_depth(depth)
        self.unlock()
Пример #38
0
    def destroy(self):
        """C.destroy () -> None

        Destroys the Container and removes it from its event system.
        """
        _pop = self.children.pop
        while len(self.children) > 0:
            widget = _pop()
            widget.parent = None
            widget.destroy()
            del widget
        # del self.children
        BaseWidget.destroy(self)
Пример #39
0
    def destroy(self):
        """C.destroy () -> None

        Destroys the Container and removes it from its event system.
        """
        _pop = self.children.pop
        while len(self.children) > 0:
            widget = _pop()
            widget.parent = None
            widget.destroy()
            del widget
        # del self.children
        BaseWidget.destroy(self)
Пример #40
0
    def __init__(self, image):
        BaseWidget.__init__(self)
        self._picture = None
        self._path = None

        self.__click = False
        self._lastevent = None

        self._signals[SIG_MOUSEDOWN] = []
        self._signals[SIG_MOUSEUP] = []
        self._signals[SIG_CLICKED] = []
        self._signals[SIG_MOUSEMOVE] = []

        self.set_picture(image)
Пример #41
0
    def draw (self):
        """P.draw () -> None

        Draws the ProgressBar surface and places its text on it.
        """
        BaseWidget.draw (self)
        if self.text:
            sf_text = base.GlobalStyle.engine.draw_string (self.text,
                                                           self.state,
                                                           self.__class__,
                                                           self.style)
            rect = sf_text.get_rect ()
            rect.center = self.image.get_rect ().center
            self.image.blit (sf_text, rect)
Пример #42
0
    def __init__ (self, minimum, maximum, step=1.0):
        BaseWidget.__init__ (self)

        self._signals[SIG_VALCHANGED] = []
        
        # Ranges and step value.
        self._minimum = minimum  # Set the min and max values temporary
        self._maximum = maximum  # and check them later.
        self._step = 0.0
        self._value = 0.0

        if minimum >= maximum:
            raise ValueError ("minimum must be smaller than maximum")
        self.set_step (step)
Пример #43
0
    def __init__ (self, image):
        BaseWidget.__init__ (self)
        self._picture = None
        self._path = None

        self.__click = False
        self._lastevent = None
        
        self._signals[SIG_MOUSEDOWN] = []
        self._signals[SIG_MOUSEUP] = []
        self._signals[SIG_CLICKED] = []
        self._signals[SIG_MOUSEMOVE] = []

        self.set_picture (image)
Пример #44
0
    def __init__(self, minimum, maximum, step=1.0):
        BaseWidget.__init__(self)

        self._signals[SIG_VALCHANGED] = []

        # Ranges and step value.
        self._minimum = minimum  # Set the min and max values temporary
        self._maximum = maximum  # and check them later.
        self._step = 0.0
        self._value = 0.0

        if minimum >= maximum:
            raise ValueError("minimum must be smaller than maximum")
        self.set_step(step)
Пример #45
0
    def __init__ (self, text):
        BaseWidget.__init__ (self)

        # Mnemonic identifiers in a tuple: (index, key).
        self._mnemonic = (-1, None)
        self._widget = None
        self.__active = False # Internal mnemonic handler.
        
        self._multiline = False
        self._linespace = 0
        self._text = None
        self._padding = 2
        self._align = ALIGN_NONE
        self.set_text (text)
Пример #46
0
    def draw (self):
        """I.draw () -> None

        Draws the ImageLabel surface and places its picture on it.
        """
        BaseWidget.draw (self)

        rect_img = None
        rect_child = None
        rect = self.image.get_rect ()
        
        rect_img = self.picture.get_rect ()
        rect_img.center = rect.center
        rect_img.centery = rect.centery
        self.image.blit (self.picture, rect_img)
Пример #47
0
    def draw(self):
        """I.draw () -> None

        Draws the ImageLabel surface and places its picture on it.
        """
        BaseWidget.draw(self)

        rect_img = None
        rect_child = None
        rect = self.image.get_rect()

        rect_img = self.picture.get_rect()
        rect_img.center = rect.center
        rect_img.centery = rect.centery
        self.image.blit(self.picture, rect_img)
Пример #48
0
    def notify(self, event):
        """I.notify (...) -> None

        Notifies the ImageMap about an event.
        """
        if not self.sensitive:
            return

        if event.signal in SIGNALS_MOUSE:
            eventarea = self.rect_to_client()
            if event.signal == SIG_MOUSEDOWN:
                if eventarea.collidepoint(event.data.pos):
                    self._lastevent = event
                    if event.data.button == 1:
                        self.state = STATE_ACTIVE
                        self.__click = True
                    self.run_signal_handlers(SIG_MOUSEDOWN, event.data)
                    event.handled = True

            elif event.signal == SIG_MOUSEUP:
                if eventarea.collidepoint(event.data.pos):
                    self._lastevent = event
                    self.run_signal_handlers(SIG_MOUSEUP, event.data)
                    if event.data.button == 1:
                        if self.state == STATE_ACTIVE:
                            self.state = STATE_ENTERED
                        else:
                            self.state = STATE_NORMAL
                        if self.__click:
                            self.__click = False
                            self.run_signal_handlers(SIG_CLICKED)
                    event.handled = True
                elif (event.data.button == 1) and (self.state == STATE_ACTIVE):
                    self.__click = False
                    self.state = STATE_NORMAL

            elif event.signal == SIG_MOUSEMOVE:
                if eventarea.collidepoint(event.data.pos):
                    self._lastevent = event
                    if self.state == STATE_NORMAL:
                        self.state = STATE_ENTERED
                    self.run_signal_handlers(SIG_MOUSEMOVE, event.data)
                    event.handled = True
                elif self.state == STATE_ENTERED:
                    self.state = STATE_NORMAL

        BaseWidget.notify(self, event)
Пример #49
0
    def notify (self, event):
        """I.notify (...) -> None

        Notifies the ImageMap about an event.
        """
        if not self.sensitive:
            return

        if event.signal in SIGNALS_MOUSE:
            eventarea = self.rect_to_client ()
            if event.signal == SIG_MOUSEDOWN:
                if eventarea.collidepoint (event.data.pos):
                    self._lastevent = event
                    if event.data.button == 1:
                        self.state = STATE_ACTIVE
                        self.__click = True
                    self.run_signal_handlers (SIG_MOUSEDOWN, event.data)
                    event.handled = True
            
            elif event.signal == SIG_MOUSEUP:
                if eventarea.collidepoint (event.data.pos):
                    self._lastevent = event
                    self.run_signal_handlers (SIG_MOUSEUP, event.data)
                    if event.data.button == 1:
                        if self.state == STATE_ACTIVE:
                            self.state = STATE_ENTERED
                        else:
                            self.state = STATE_NORMAL
                        if self.__click:
                            self.__click = False
                            self.run_signal_handlers (SIG_CLICKED)
                    event.handled = True
                elif (event.data.button == 1) and (self.state == STATE_ACTIVE):
                    self.__click = False
                    self.state = STATE_NORMAL

            elif event.signal == SIG_MOUSEMOVE:
                if eventarea.collidepoint (event.data.pos):
                    self._lastevent = event
                    if self.state == STATE_NORMAL:
                        self.state = STATE_ENTERED
                    self.run_signal_handlers (SIG_MOUSEMOVE, event.data)
                    event.handled = True
                elif self.state == STATE_ENTERED:
                    self.state = STATE_NORMAL

        BaseWidget.notify (self, event)
Пример #50
0
    def __init__ (self):
        BaseWidget.__init__ (self)
        
        self._text = ''
        self._editable = True

        # Caret | position.
        self._caret = 0
        self._caretvisible = True
        self._timer = _TIMER
        
        self._signals[SIG_KEYDOWN] = []
        self._signals[SIG_INPUT] = []
        self._signals[SIG_TICK] = None # No events for this one.

        # Temporary placeholder for text input and ESCAPE.
        self._temp = None
Пример #51
0
    def __init__(self):
        BaseWidget.__init__(self)

        self._text = ''
        self._editable = True

        # Caret | position.
        self._caret = 0
        self._caretvisible = True
        self._timer = _TIMER

        self._signals[SIG_KEYDOWN] = []
        self._signals[SIG_INPUT] = []
        self._signals[SIG_TICK] = None  # No events for this one.

        # Temporary placeholder for text input and ESCAPE.
        self._temp = None
Пример #52
0
    def __init__(self):
        BaseWidget.__init__(self)

        # Negative values. Influences the axes.
        self._negative = False

        # Horizontal or vertical mapping of the axes.
        self._orientation = ORIENTATION_HORIZONTAL

        # Coordinates of the point of origin on the widget.
        self._origin = (0, 0)

        # The data to evaluate and the return values.
        self._data = None
        self._values = None

        # The eval func.
        self._evalfunc = None
Пример #53
0
    def update(self, **kwargs):
        """B.update (...) -> None

        Updates the Bin and refreshes its image and rect content.

        Updates the Bin and causes its parent to update itself on
        demand.
        """
        children = kwargs.get("children", {})
        resize = kwargs.get("resize", False)

        if self.locked:
            return
        # We have to check for possible size changes here!
        if resize:
            self.dirty = True
        else:
            BaseWidget.update(self, children=children, resize=resize)
Пример #54
0
    def update (self, **kwargs):
        """B.update (...) -> None

        Updates the Bin and refreshes its image and rect content.

        Updates the Bin and causes its parent to update itself on
        demand.
        """
        children = kwargs.get ("children", {})
        resize = kwargs.get ("resize", False)

        if self.locked:
            return
        # We have to check for possible size changes here!
        if resize:
            self.dirty = True
        else:
            BaseWidget.update (self, children=children, resize=resize)
Пример #55
0
    def init_ui(self):
        
        # Window creation ==================================================================
        self.setWindowTitle("MRI_GUI")
        self.setWindowIcon(QIcon(os.path.join(self.iconsDir, 'brain.png')))
        self.statusBar().showMessage('ready')

        # Menu Bar =========================================================================
        act_exit = QAction('&Exit', self)
        act_exit.setShortcut('Ctrl+Q')
        act_exit.setStatusTip('Exit application')
        act_exit.triggered.connect(self.quit_menu)

        brainsuite = QAction('&BrainSuite', self)
        brainsuite.triggered.connect(self.open_external_gui)

        dsi_studio = QAction('&dsi_studio', self)
        dsi_studio.triggered.connect(self.open_external_gui)

        freesurfer = QAction('&freeview', self)
        freesurfer.triggered.connect(self.open_external_gui)

        slicer = QAction('&Slicer', self)
        slicer.triggered.connect(self.open_external_gui)

        trackvis = QAction('&trackvis', self)
        slicer.triggered.connect(self.open_external_gui)

        menubar = self.menuBar()
        
        file_menu = menubar.addMenu('&File')
        file_menu.addAction(act_exit)

        file_menu = menubar.addMenu('&External GUIs')
        file_menu.addAction(brainsuite)
        file_menu.addAction(dsi_studio)
        file_menu.addAction(freesurfer)
        file_menu.addAction(slicer)
        file_menu.addAction(trackvis)

        # GUI layout =======================================================================
        # Base widget is the parent of each sub-widget within the GUI, it holds the files info
        self.baseWidget = BaseWidget(self)
        
        # Show Main Window
        self.setCentralWidget(self.baseWidget)

        self.resize(1600, 900)
        self.show()
Пример #56
0
    def notify(self, event):
        """E.notify (...) -> None

        Notifies the Editable about an event.
        """
        if not self.sensitive:
            return

        # The next few events are only available, if the entry is focused.
        if self.focus:
            # Blinking caret.
            if event.signal == SIG_TICK:
                self._timer -= 1
                if self._timer == 0:
                    self._caretvisible = not self._caretvisible
                    self._timer = _TIMER
                    self.dirty = True

            elif event.signal == SIG_KEYDOWN:
                self.run_signal_handlers(SIG_KEYDOWN, event.data)
                event.handled = self._input(event.data)
                self._caretvisible = True

        BaseWidget.notify(self, event)
Пример #57
0
 def __init__(self, text):
     BaseWidget.__init__(self)
     self._padding = 2
     self._text = None
     self.set_text(text)
Пример #58
0
 def __init__(self):
     BaseWidget.__init__(self)
     self._children = []
     self._spacing = 2
     self._padding = 2
Пример #59
0
    def __init__(self):
        super().__init__()

        # Subdirectories of MRI_GUI ========================================================
        # instance directory of sub-folders, they will be modifiable through the GUI
        self.dir_dic = dict()

        self.dir_dic['base_dir'] = os.path.dirname(os.path.realpath(__file__))
        self.dir_dic['icons_dir'] = os.path.join(self.dir_dic['base_dir'],
                                                 'icons')

        self.dir_dic['data_dir'] = '/mnt/data'
        self.dir_dic['templates_dir'] = '/mnt/data/templates'

        # when functions don't accept output files as options we will output by
        # default to a temporary directory and move the files
        # self.dir_dic['temp_dir'] = os.path.join('/tmp', 'MRI_temp')
        self.dir_dic['temp_dir'] = os.path.join('/mnt/data', 'MRI_temp')
        if not os.path.isdir(self.dir_dic['temp_dir']):
            os.mkdir(self.dir_dic['temp_dir'])

        # Bids Parser initialization =======================================================
        self.bids = Parser()
        self.bids.walk_path(self.dir_dic['data_dir'])

        # UI Initialization ================================================================
        # Window creation
        self.setWindowTitle("MRI_GUI")
        self.setWindowIcon(
            QIcon(os.path.join(self.dir_dic['icons_dir'], 'brain.png')))
        self.statusBar().showMessage('ready')

        # Menu Bar
        act_exit = QAction('&Exit', self)
        act_exit.setShortcut('Ctrl+Q')
        act_exit.setStatusTip('Exit application')
        act_exit.triggered.connect(self.quit_menu)

        slicer = QAction('&Slicer', self)
        slicer.triggered.connect(self.open_external_gui)

        trackvis = QAction('&trackvis', self)
        trackvis.triggered.connect(self.open_external_gui)

        menu_bar = self.menuBar()

        file_menu = menu_bar.addMenu('&File')
        file_menu.addAction(act_exit)

        file_menu = menu_bar.addMenu('&External GUIs')
        file_menu.addAction(slicer)
        file_menu.addAction(trackvis)

        # GUI layout
        # Base widget is the parent of each sub-widget within the GUI: ToolsMenu, ToolsInterface and FileNav
        # passing the directory dictionary and the bids parser handle
        self.base_widget = BaseWidget(self, self.dir_dic, self.bids)

        # Show Main Window
        self.setCentralWidget(self.base_widget)

        self.resize(1600, 900)
        self.setFixedSize(self.size())
        self.show()
Пример #60
0
application. All provided classes are fully accessible and support
various attributes and methods to make them suitable for a GUI driven
program.
"""

# Initialize the widget subsystem.
import base
base.init ()

import Constants
import StyleInformation
from Style import WidgetStyle, Style

# Basic widgets.
from BaseWidget import BaseWidget
BaseWidget.initclass ()

from Alignment import Alignment
from ButtonBase import ButtonBase
from Button import Button
from CheckButton import CheckButton
from Entry import Entry
from ImageButton import ImageButton
from Label import Label
from ImageLabel import ImageLabel
from ProgressBar import ProgressBar
from RadioButton import RadioButton
from Scale import HScale, VScale
from ScrollBar import HScrollBar, VScrollBar
from ToggleButton import ToggleButton
from ImageMap import ImageMap