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, 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])