def finish(self): Clickable.finish(self) ## self.e_color.stick_to(self, "right", "right") ## self.e_color.move((-2,0)) store(self, mode="h") self.fit_children() self._set_launcher()
def _get_launched_el(self, els, size, storer_params): _done_element = Clickable(style.OK_TXT) _cancel_element = Clickable(style.CANCEL_TXT) _done_element.finish() _cancel_element.finish() g = Ghost([_done_element, _cancel_element]) g.finish() g.englobe_childrens() g.rank = float("inf") store(g, g.get_elements(), "h") els += [g] box = Box(elements=els, size=size, storer_params=storer_params) box.finish() #box stores its elements return box, _done_element, _cancel_element
def __init__(self, elements=None, normal_params=None, height=None): Element.__init__(self, "", elements, normal_params) h = max([e.get_storer_rect().height for e in self.get_elements()]) + 2 store(self, mode="h", x=1, y=h / 2, align="center") if self.father: w = self.father.get_storer_rect().width else: w = functions.get_screen_size()[0] size = (w, h) painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER, pressed=True, size=size, radius=style.BOX_RADIUS) self.set_painter(painter)
def __init__(self, elements=None, normal_params=None, height=None): Element.__init__(self, "", elements, normal_params) h = max([e.get_storer_rect().height for e in self.get_elements()]) + 2 store(self, mode="h", x=1, y=h/2, align="center") if self.father: w = self.father.get_storer_rect().width else: w = functions.get_screen_size()[0] size = (w, h) painter = functions.obtain_valid_painter(painterstyle.BOX_PAINTER, pressed=True, size=size, radius=style.BOX_RADIUS) self.set_painter(painter)
def __init__(self, browser, name_txt="", file_txt="", launcher_txt="", normal_params=None, file_width=None, show_select=True, click_quit=False): """<browser> : the browser to be launched. Can either be a Browser instance or a BrowserLight instance. <name_txt> : the text that stands before the (optionnal) file name and the button to launch browser. <file_txt> : the default value shown to the user. <launcher_txt> : the text on the launcher button. """ file_width = style.FILE_WIDTH if file_width is None else file_width self.show_select = show_select if not self.show_select: file_txt = "" _Launcher.__init__(self, "", normal_params, click_quit) self._spawn = "center" self.file_width = file_width self._done_element = Clickable(style.OK_TXT) self._done_element.finish() self._cancel_element = Clickable(style.CANCEL_TXT) self._cancel_element.finish() g = Ghost([self._done_element, self._cancel_element]) g.finish() g.fit_children() g.rank = float("inf") store(g, g.get_elements(), "h") # to launch : must not be in self._elements! self.browser = browser box = Box(elements=[self.browser, g], storer_params=None) box.finish() self.launched_element = box self._deny_child(self.launched_element) # launcher self.launcher_el = self.get_launcher_element(launcher_txt) self.launcher_el.user_func = self.launch_box # name self._name_element = self._get_name_element(name_txt) self._name_element.user_func = self.launch_box self._file_element = self._get_file_element(file_txt) self.add_elements([self._name_element, self.launcher_el, self._file_element])
def __init__(self, browser, name_txt, file_txt, launcher_txt, normal_params=None, file_width=None, show_select=True, click_quit=False): """<browser> : the browser to be launched. Can either be a Browser instance or a BrowserLight instance. <name_txt> : the text that stands before the (optionnal) file name and the button to launch browser. <file_txt> : the default value shown to the user. <launcher_txt> : the text on the launcher button. """ file_width = style.FILE_WIDTH if file_width is None else file_width self.show_select = show_select if not self.show_select: file_txt = "" _Launcher.__init__(self, "", normal_params, click_quit) self._spawn = "center" self.file_width = file_width self._done_element = Clickable(style.OK_TXT) self._done_element.finish() self._cancel_element = Clickable(style.CANCEL_TXT) self._cancel_element.finish() g = Ghost([self._done_element, self._cancel_element]) g.finish() g.englobe_childrens() g.rank = float("inf") store(g, g.get_elements(), "h") # to launch : must not be in self._elements! self.browser = browser box = Box(elements=[self.browser, g], storer_params=None) box.finish() self.launched_element = box self._deny_child(self.launched_element) # launcher self.launcher_el = self.get_launcher_element(launcher_txt) self.launcher_el.user_func = self.launch_box # name self._name_element = self._get_name_element(name_txt) self._name_element.user_func = self.launch_box self._file_element = self._get_file_element(file_txt) self.add_elements( [self._name_element, self.launcher_el, self._file_element])
def make_stored_ghost(elements, mode="h"): ghost = Ghost(elements) ghost.finish() store(ghost, mode=mode) ghost.fit_children() return ghost
def _refresh_pos(self): storage.store(self, mode="h") self.fit_children()