def __init__(self, gui, text, orientation, buttons, parent, nomargin=False): OrientedWidget.__init__(self, orientation, parent) self.buttons = {} self.groups = {} i = 0 n = len(buttons) while i < n: if buttons[i] == gui.StateButtonsBegin: state_buttons = [] for j in range(i + 1, n): if buttons[j] == gui.StateButtonsEnd: s = gui.state_buttons(orientation, state_buttons, self, nomargin) self.buttons.update(s.buttons) self.groups[buttons[i + 1]] = s i = j break else: state_buttons.append(buttons[j]) elif buttons[i] == gui.Spacing: self.layout().addSpacing(10) elif type(buttons[i] == int): self.buttons[buttons[i]] = gui.tool_button(buttons[i], self) elif len(buttons[i] == 4): gui.tool_button(buttons[i], self) else: self.buttons[buttons[i][0]] = gui.tool_button(buttons[i], self) i = i + 1 self.layout().addStretch()
def __init__(self, gui, text, orientation, buttons, parent, nomargin = False): OrientedWidget.__init__(self, orientation, parent) self.buttons = {} self.groups = {} i = 0 n = len(buttons) while i < n: if buttons[i] == gui.StateButtonsBegin: state_buttons = [] for j in range(i+1, n): if buttons[j] == gui.StateButtonsEnd: s = gui.state_buttons(orientation, state_buttons, self, nomargin) self.buttons.update(s.buttons) self.groups[buttons[i+1]] = s i = j break else: state_buttons.append(buttons[j]) elif buttons[i] == gui.Spacing: self.layout().addSpacing(10) elif type(buttons[i] == int): self.buttons[buttons[i]] = gui.tool_button(buttons[i], self) elif len(buttons[i] == 4): gui.tool_button(buttons[i], self) else: self.buttons[buttons[i][0]] = gui.tool_button(buttons[i], self) i = i + 1 self.layout().addStretch()
def __init__(self, gui, orientation, buttons, parent, nomargin=False): OrientedWidget.__init__(self, orientation, parent) self.buttons = {} if nomargin: self.layout().setContentsMargins(0, 0, 0, 0) self._clicked_button = None for i in buttons: b = gui.tool_button(i, self) b.triggered.connect(self.button_clicked) self.buttons[i] = b self.layout().addWidget(b)
def __init__(self, gui, orientation, buttons, parent, nomargin = False): OrientedWidget.__init__(self, orientation, parent) self.buttons = {} if nomargin: self.layout().setContentsMargins(0, 0, 0, 0) self._clicked_button = None for i in buttons: b = gui.tool_button(i, self) QObject.connect(b, SIGNAL("triggered(QAction*)"), self.button_clicked) self.buttons[i] = b self.layout().addWidget(b)