Changeset 9381:23e1f34c1ee4 in orange


Ignore:
Timestamp:
12/17/11 13:26:05 (2 years ago)
Author:
miha <miha.stajdohar@…>
Branch:
default
Convert:
55a287246165c367f6221c35e478b57fd7c3ae5e
Message:

Added nomargin option to zoom select toolbar.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orange/OrangeWidgets/plot/owplotgui.py

    r9375 r9381  
    6666        :type parent: :obj:`.QWidget` 
    6767    ''' 
    68     def __init__(self, gui, text, orientation, buttons, parent): 
     68    def __init__(self, gui, text, orientation, buttons, parent, nomargin = False): 
    6969        OrientedWidget.__init__(self, orientation, parent) 
    7070        self.buttons = {} 
     
    7777                for j in range(i+1, n): 
    7878                    if buttons[j] == gui.StateButtonsEnd: 
    79                         s = gui.state_buttons(orientation, state_buttons, self) 
     79                        s = gui.state_buttons(orientation, state_buttons, self, nomargin) 
    8080                        self.buttons.update(s.buttons) 
    8181                        self.groups[buttons[i+1]] = s 
     
    112112        :type parent: :obj:`.QWidget` 
    113113    ''' 
    114     def __init__(self, gui, orientation, buttons, parent): 
     114    def __init__(self, gui, orientation, buttons, parent, nomargin = False): 
    115115        OrientedWidget.__init__(self, orientation, parent) 
    116116        self.buttons = {} 
    117         self.layout().setContentsMargins(0, 0, 0, 0) 
     117        if nomargin: 
     118            self.layout().setContentsMargins(0, 0, 0, 0) 
    118119        self._clicked_button = None 
    119120        for i in buttons: 
     
    461462        return b 
    462463         
    463     def state_buttons(self, orientation, buttons, widget): 
     464    def state_buttons(self, orientation, buttons, widget, nomargin = False): 
    464465        ''' 
    465466            This function creates a set of checkable buttons and connects them so that only one 
    466467            may be checked at a time.  
    467468        ''' 
    468         c = StateButtonContainer(self, orientation, buttons, widget) 
     469        c = StateButtonContainer(self, orientation, buttons, widget, nomargin) 
    469470        if widget.layout() is not None: 
    470471            widget.layout().addWidget(c) 
    471472        return c 
    472473         
    473     def toolbar(self, widget, text, orientation, buttons): 
     474    def toolbar(self, widget, text, orientation, buttons, nomargin = False): 
    474475        ''' 
    475476            Creates an :obj:`.OWToolbar` with the specified ``text``, ``orientation`` and ``buttons`` and adds it to ``widget``.  
     
    477478            .. seealso:: :obj:`.OWToolbar` 
    478479        ''' 
    479         t = OWToolbar(self, text, orientation, buttons, widget) 
     480        t = OWToolbar(self, text, orientation, buttons, widget, nomargin) 
     481        if nomargin: 
     482            t.layout().setContentsMargins(0, 0, 0, 0) 
    480483        if widget.layout() is not None: 
    481484            widget.layout().addWidget(t) 
    482485        return t 
    483486         
    484     def zoom_select_toolbar(self, widget, text = 'Zoom / Select', orientation = Qt.Horizontal, buttons = default_zoom_select_buttons): 
    485         t = self.toolbar(widget, text, orientation, buttons) 
     487    def zoom_select_toolbar(self, widget, text = 'Zoom / Select', orientation = Qt.Horizontal, buttons = default_zoom_select_buttons, nomargin = False): 
     488        t = self.toolbar(widget, text, orientation, buttons, nomargin) 
    486489        t.buttons[self.Select].click() 
    487490        return t     
Note: See TracChangeset for help on using the changeset viewer.