def buildLoadBox(self): # build the load label loadLable = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) loadLable.text = "<b>Processing</b>" loadLable.show() # build the spinning wheel wheel = Progressbar(self, pulse_mode=True, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) wheel.pulse(True) wheel.show() detailsbtn = Button(self, style="anchor") detailsbtn.text_set("Details") detailsbtn.callback_pressed_add(self.innerWinShow) detailsbtn.show() # build the status label self.statusLabel = Label(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) self.statusLabel.show() # put all the built objects in a vertical box box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(loadLable) box.pack_end(wheel) box.pack_end(self.statusLabel) box.pack_end(detailsbtn) box.show() return box
def buildDetailsWin(self): self.updateText = Entry(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) self.updateText.editable_set(False) self.updateText.scrollable_set(True) self.updateText.show() closebtn = Button(self) closebtn.text_set("Done") closebtn.callback_pressed_add(self.innerWinHide) closebtn.show() box = Box(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_BOTH) box.pack_end(self.updateText) box.pack_end(closebtn) box.show() self.innerWin = InnerWindow(self, size_hint_weight=EXPAND_BOTH, size_hint_align=FILL_HORIZ) self.innerWin.content_set(box)
def __init__(self, parent, h): if not h.is_valid(): Information(parent.win, "Invalid torrent handle.") return if not h.has_metadata(): Information(parent.win, "Torrent contains no metadata.") return i = h.get_torrent_info() InnerWindow.__init__(self, parent.win) box = Box(self) box.size_hint_align = -1.0, -1.0 box.size_hint_weight = 1.0, 1.0 tname = Label(self) tname.size_hint_align = -1.0, 0.5 tname.line_wrap = ELM_WRAP_CHAR tname.ellipsis = True tname.text = "{}".format(cgi.escape(i.name())) tname.show() box.pack_end(tname) for func in i.comment, i.creation_date, i.creator: try: w = func() except Exception as e: log.debug(e) else: if w: f = Frame(self) f.size_hint_align = -1.0, 0.0 f.text = func.__name__.replace("_", " ").capitalize() l = Label(self) l.ellipsis = True l.text = cgi.escape(str(w)) l.show() f.content = l f.show() box.pack_end(f) tpriv = Check(self) tpriv.size_hint_align = 0.0, 0.0 tpriv.text = "Private" tpriv.tooltip_text_set("Whether this torrent is private.<br> \ i.e., it should not be distributed on the trackerless network<br> \ (the kademlia DHT).") tpriv.disabled = True tpriv.state = i.priv() magnet_uri = lt.make_magnet_uri(h) f = Frame(self) f.size_hint_align = -1.0, 0.0 f.text = "Magnet URI" me_box = Box(self) me_box.horizontal = True me = Entry(self) me.size_hint_align = -1.0, 0.0 me.size_hint_weight = 1.0, 0.0 #me.editable = False me.entry = magnet_uri me_box.pack_end(me) me.show() me_btn = Button(self) me_btn.text = "Copy" if hasattr(me, "cnp_selection_set"): me_btn.callback_clicked_add( lambda x: me.top_widget.cnp_selection_set( ELM_SEL_TYPE_CLIPBOARD, ELM_SEL_FORMAT_TEXT, me.text)) else: import pyperclip me_btn.callback_clicked_add(lambda x: pyperclip.copy(magnet_uri)) me_btn.show() me_box.pack_end(me_btn) me_box.show() f.content = me_box f.show() box.pack_end(f) fl_btn = Button(self) fl_btn.text = "Files ->" fl_btn.callback_clicked_add(self.file_list_cb, h) xbtn = Button(self) xbtn.text_set("Close") xbtn.callback_clicked_add(lambda x: self.delete()) for w in tpriv, fl_btn, xbtn: w.show() box.pack_end(w) box.show() nf = self.nf = Naviframe(self) nf.item_simple_push(box) self.content_set(nf) self.activate()