def page_add(self, name, title="", subtitle="", separator=False): box = Box(self) box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) box.show() content = Box(self) content.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) content.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) box.pack_end(content) content.show() if separator: sp = Separator(self) sp.horizontal_set(True) box.pack_end(sp) sp.show() actions = Box(self) actions.horizontal_set(True) box.pack_end(actions) actions.show() self.__pages[name] = (title, subtitle, box, content, actions, {}) self.title_text = title self.subtitle_text = subtitle self.__pager.item_simple_push(box) self.__current_page = name
def __init__(self, parent, width=None, height=None, group=None): InnerWindow.__init__(self, parent) self._parent = parent #self.style_set("minimal") # size fallbacks to __layout's min/max box = Box(self) box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) box.show() content = Box(self) content.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) content.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) box.pack_end(content) content.show() actions = Box(self) actions.horizontal_set(True) box.pack_end(actions) actions.show() btn = WizardAction(self._parent, "Close", self.close, "Escape", None) btn.show() actions.pack_end(btn) layout = Layout(self) self.__edje = layout.edje_get() theme_file = sysconfig.theme_file_get("default") _width = width or self.default_width _height = height or self.default_height _group = group or self.default_group layout.file_set(theme_file, _group) layout.size_hint_min_set(_width, _height) layout.size_hint_max_set(_width, _height) InnerWindow.content_set(self, layout) layout.show() layout.content_set("content", box) self.__sc = Entry(self) self.__sc.scrollable_set(True) self.__sc.editable_set(False) self.__sc.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.__sc.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.__sc.bounce_set(False, False) self.__sc.show() content.pack_end(self.__sc)
class ConfirmPopUp(PopUp): def __init__(self, parent, group=None, select_cb=None): PopUp.__init__(self, parent, group or "editje/confirm") self.style_set("minimal") self.text_set("header.title", "Overwrite existing file ?") self._set_controls() def set_message(self, message): self.text_set("filename", message) def action_add(self, label, func_cb, data=None): btn = Button(self) btn.text_set(label) btn.data["clicked"] = (func_cb, data) btn.callback_clicked_add(self._action_btn_clicked) btn.size_hint_min_set(100, 30) btn.size_hint_max_set(100, 30) btn.show() self.box.pack_end(btn) def _action_btn_clicked(self, bt, *args, **kwargs): func, udata = bt.data["clicked"] func(udata) def _set_controls(self): self.box = Box(self) self.box.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.box.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self.box.horizontal_set(True) self.box.show() self.content_set("actions", self.box) def _close_cb(self, data): self.close() def close(self): PopUp.close(self)