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 _show_actions(self, it, ti, state): strstate = "%s %.2f" % state self.actions_box = Box(self._pop) name_box = Box(self._pop) lb_state = Label(self._pop) lb_state.text_set("<b>State: ") lb_name = Label(self._pop) lb_name.text_set(strstate) name_box.horizontal_set(True) name_box.pack_end(lb_state) lb_state.show() name_box.pack_end(lb_name) lb_name.show() self.actions_box.pack_end(name_box) name_box.show() space = Label(self._pop) space.text_set(" ") self.actions_box.pack_end(space) space.show() self._action_button_add("Change to", self._states_select_cb, state) self._action_button_add("Reset to", self._reset_state_to_cb, state) btn_delete = self._action_button_add( "Delete", self._remove_state_cb, state) if self._is_default(state): btn_delete.disabled_set(True) lb_name.style_set("editje.statedefault") else: lb_name.style_set("editje.statenormal") self.pager.content_push(self.actions_box) self._pop.actions_clear() self._pop.action_add("Back", self._back_to_list_cb) self._pop.action_add("Close", self._cancel_clicked)
def _show_actions(self, it, ti, state): strstate = "%s %.2f" % state self.actions_box = Box(self._pop) name_box = Box(self._pop) lb_state = Label(self._pop) lb_state.text_set("<b>State: ") lb_name = Label(self._pop) lb_name.text_set(strstate) name_box.horizontal_set(True) name_box.pack_end(lb_state) lb_state.show() name_box.pack_end(lb_name) lb_name.show() self.actions_box.pack_end(name_box) name_box.show() space = Label(self._pop) space.text_set(" ") self.actions_box.pack_end(space) space.show() self._action_button_add("Change to", self._states_select_cb, state) self._action_button_add("Reset to", self._reset_state_to_cb, state) btn_delete = self._action_button_add("Delete", self._remove_state_cb, state) if self._is_default(state): btn_delete.disabled_set(True) lb_name.style_set("editje.statedefault") else: lb_name.style_set("editje.statenormal") self.pager.item_simple_push(self.actions_box) self._pop.actions_clear() self._pop.action_add("Back", self._back_to_list_cb) self._pop.action_add("Close", self._cancel_clicked)
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)
def _notify(self, message): if self.__notification: self.__notification.hide() self.__notification.delete() self.__notification = None self.__notification = Notify(self._parent) self.__notification.timeout_set(4) self.__notification.orient_set(ELM_NOTIFY_ORIENT_BOTTOM) bx = Box(self) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.horizontal_set(True) self.__notification.content_set(bx) bx.show() lb = Label(self) lb.text_set(message) bx.pack_end(lb) lb.show() self.__notification.show()
def notify(self, message): if self.__notification: self.__notification.hide() self.__notification.delete() self.__notification = None self.__notification = Notify(self) self.__notification.timeout_set(2) self.__notification.orient_set(ELM_NOTIFY_ORIENT_TOP) bx = Box(self) bx.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) bx.horizontal_set(True) self.__notification.content_set(bx) bx.show() lb = Label(self) lb.text_set(message) bx.pack_end(lb) lb.show() self.__notification.show()