def __init__(self, title, message, affirmative_label, decline_label="Cancel", width=500, modal=False): Dialog.__init__(self, title=title, width=width, modal=modal) scrollbox = ScrollArea(Label(markup=message, padding=5, overflow=pango.WrapMode.WORD), scroll_horizontal=False, border=0, margin=2, margin_right=3, height=150) affirmative = Button(affirmative_label, id="affirmative_button") affirmative.connect("on-click", self._on_button_click) decline = Button(decline_label, id="decline_button") decline.connect("on-click", self._on_button_click) self.box.contents = VBox([ scrollbox, HBox([HBox(), decline, affirmative], expand=False, padding=10) ])
def __init__(self, rows=[], dropdown_height=None, open_below=True, overflow=pango.EllipsizeMode.END, **kwargs): ToggleButton.__init__(self, overflow=overflow, **kwargs) if dropdown_height: self.dropdown_height = dropdown_height self.padding_right = self.drop_mark_width self._scene_mouse_down = None # scene mouse down listener to hide our window if clicked anywhere else self._echo = False self.listitem = self.DropdownClass(select_on_drag=True) self.connect_child(self.listitem, "on-mouse-move", self._on_listitem_mouse_move) self.connect_child(self.listitem, "on-mouse-up", self._on_listitem_mouse_up) self.connect_child(self.listitem, "on-select", self._on_listitem_select) #: the list of text strings available for selection self.rows = rows #: Whether the dropdown should appear below or over the input element self.open_below = open_below if rows: self._set_label(self.label or rows[0]) self.scrollbox = ScrollArea(fill=False) self.scrollbox.add_child(self.listitem) self.connect("on-mouse-move", self.__on_mouse_move) self.connect("on-mouse-down", self.__on_mouse_down) self.connect("on-click", self.__on_click) self.connect("on-toggle", self._on_toggle) self.connect("on-key-press", self._on_key_press) self._echo_up = False
def __init__(self, label="", contents=[], expand=False, spacing=0, expanded=False, **kwargs): VBox.__init__(self, expand=expand, spacing=spacing, **kwargs) self.expanded = expanded self._caption = self.caption_class(label, x_align=0, expanded=self.expanded, expand=False) self.connect_child(self._caption, "on-click", self.on_caption_mouse_down) self.container = ScrollArea(scroll_vertical=False, scroll_horizontal=False, visible=False, border=0) self.add_child(self._caption, self.container) self.add_child(*contents)