def __init__(self, parent, label, func, key=None, data=None): Button.__init__(self, parent) self.text_set(label) self.callback_clicked_add(self.__action_btn_clicked) self.size_hint_weight_set(evas.EVAS_HINT_EXPAND, evas.EVAS_HINT_EXPAND) self.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) self._func = func self._data = data self._key = key
def boot_cmd(win=False): with open("/proc/cmdline") as file1: bootcmd = file1.readline()[:-1] if win: from elementary import Popup, Entry, Button, Icon en = Entry(win) en.entry_set(bootcmd) bt = Button(win) bt.text = "Close" bt.callback_clicked_add(lambda o: popup.delete()) ic = Icon(win) ic.standard_set("system") popup = Popup(win) popup.size_hint_weight = (1.0, 1.0) popup.part_content_set("title,icon", ic) popup.part_text_set("title,text", "Boot Command") popup.part_content_set("default", en) popup.part_content_set("button1", bt) popup.show() else: return bootcmd
def action_add(self, label, func_cb, data=None): btn = Button(self._parent) self._action_btns.append(btn) btn.text_set(label) btn.callback_clicked_add(self._action_btn_clicked) btn.size_hint_weight_set(1.0, 1.0) btn.size_hint_align_set(-1.0, -1.0) btn.data["clicked"] = (func_cb, data) btn.show() self.edje_get().part_box_append("actions", btn)
def _action_button_add(self, label, callback, state): btn = Button(self._pop) btn.text_set(label) btn.callback_clicked_add(callback, state) btn.size_hint_align_set(evas.EVAS_HINT_FILL, evas.EVAS_HINT_FILL) btn.size_hint_weight_set(0.0, 0.0) self.actions_box.pack_end(btn) btn.show() return btn
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)