Move proxy settings to its own naviframe page.

This commit is contained in:
Kai Huuhko 2013-08-23 20:33:37 +03:00
parent 827fd1ada4
commit 61bc184136
2 changed files with 35 additions and 30 deletions

14
TODO
View File

@ -1,7 +1,9 @@
High priority: I18N:
☐ I18N This should wait until most of the features are in and the strings are stable.
This should wait until most of the features are in and the strings are stable. ☐ Make strings localizable
☐ Add Torrent-dialog ☐ Create pot file
☐ Generate po files
Add Torrent-dialog:
☐ Create a new class to hold a torrent and store its instances between sessions. ☐ Create a new class to hold a torrent and store its instances between sessions.
Migrate the old dict(ihash->torrent_file) to the new list of torrents Migrate the old dict(ihash->torrent_file) to the new list of torrents
☐ Dialog window ☐ Dialog window
@ -9,7 +11,7 @@ High priority:
☐ File selector ☐ File selector
☐ Storage path ☐ Storage path
☐ Add preferences for initial/automatic values for the above ☐ Add preferences for initial/automatic values for the above
Low priority: Misc:
☐ Torrent tooltips ☐ Torrent tooltips
handle.status() handle.status()
☐ More tooltips in general ☐ More tooltips in general
@ -17,4 +19,4 @@ Low priority:
✔ Auto-paste magnet links from clipboard #epour/gui/Main.py@select_torrent @done (13-08-11 21:45) ✔ Auto-paste magnet links from clipboard #epour/gui/Main.py@select_torrent @done (13-08-11 21:45)
Note: The pasted text is not filtered. Note: The pasted text is not filtered.
☐ Construct and populate #epour/gui/Preferences.py@SessionSettings with an Idler ☐ Construct and populate #epour/gui/Preferences.py@SessionSettings with an Idler
Move proxy settings to its own naviframe page and don't autocollapse the frames Move proxy settings to its own naviframe page and don't autocollapse the frames @done (13-08-18 18:02)

View File

@ -76,12 +76,12 @@ class Preferences(InnerWindow):
mbox.size_hint_weight = 1.0, 1.0 mbox.size_hint_weight = 1.0, 1.0
mbox.size_hint_align = -1.0, -1.0 mbox.size_hint_align = -1.0, -1.0
lbl = Label(self) #lbl = Label(self)
lbl.text = "Click on a title to open/close configuration entry." #lbl.text = "Click on a title to open/close configuration entry."
limits = Limits(self, session) limits = Limits(self, session)
ports = ListenPorts(self, session) ports = ListenPorts(self, session)
pf = ProxyConfig(self) #pf = ProxyConfig(self)
pe = EncryptionSettings(self, session) pe = EncryptionSettings(self, session)
dlsel = DataStorageSelector(self, conf) dlsel = DataStorageSelector(self, conf)
@ -109,16 +109,20 @@ class Preferences(InnerWindow):
sep2 = Separator(self) sep2 = Separator(self)
sep2.horizontal = True sep2.horizontal = True
prox_btn = Button(self)
prox_btn.text = "Proxy settings ->"
prox_btn.callback_clicked_add(self.show_prox_set, nf, session)
ses_btn = Button(self) ses_btn = Button(self)
ses_btn.text = "Session settings" ses_btn.text = "Session settings ->"
ses_btn.callback_clicked_add(self.show_ses_set, nf, session) ses_btn.callback_clicked_add(self.show_ses_set, nf, session)
xbtn = Button(self) xbtn = Button(self)
xbtn.text_set("Close") xbtn.text_set("Close")
xbtn.callback_clicked_add(lambda x: self.delete()) xbtn.callback_clicked_add(lambda x: self.delete())
for w in lbl, ports, limits, pf, dlsel, pe, pad, \ for w in ports, limits, dlsel, pe, pad, \
sep1, chk1, chk2, sep2, ses_btn, xbtn: sep1, chk1, chk2, sep2, prox_btn, ses_btn, xbtn:
w.show() w.show()
mbox.pack_end(w) mbox.pack_end(w)
@ -136,6 +140,10 @@ class Preferences(InnerWindow):
ses_set = SessionSettings(self, session, nf) ses_set = SessionSettings(self, session, nf)
nf.item_simple_push(ses_set) nf.item_simple_push(ses_set)
def show_prox_set(self, btn, nf, session):
prox_set = ProxyConfig(self, session, nf)
nf.item_simple_push(prox_set)
class DataStorageSelector(Frame): class DataStorageSelector(Frame):
def __init__(self, parent, conf): def __init__(self, parent, conf):
Frame.__init__(self, parent) Frame.__init__(self, parent)
@ -143,8 +151,6 @@ class DataStorageSelector(Frame):
self.size_hint_align = -1.0, 0.0 self.size_hint_align = -1.0, 0.0
self.size_hint_weight = 1.0, 0.0 self.size_hint_weight = 1.0, 0.0
self.text = "Data storage" self.text = "Data storage"
self.collapse = True
self.autocollapse = True
self.conf = conf self.conf = conf
@ -188,8 +194,6 @@ class ListenPorts(Frame):
self.session = session self.session = session
self.size_hint_align = -1.0, -1.0 self.size_hint_align = -1.0, -1.0
self.collapse = True
self.autocollapse = True
self.text = "Listen port (range)" self.text = "Listen port (range)"
port = session.listen_port() port = session.listen_port()
@ -221,19 +225,17 @@ class ListenPorts(Frame):
self.session.conf.set("Settings", "listen_low", str(low)) self.session.conf.set("Settings", "listen_low", str(low))
self.session.conf.set("Settings", "listen_high", str(high)) self.session.conf.set("Settings", "listen_high", str(high))
class ProxyConfig(Frame): class ProxyConfig(Scroller):
def __init__(self, parent): def __init__(self, parent, session, nf):
Frame.__init__(self, parent) Scroller.__init__(self, parent)
session = self.session = parent.session self.session = session
self.collapse = True
self.autocollapse = True
self.size_hint_weight = (1.0, 0.0) self.size_hint_weight = (1.0, 0.0)
self.size_hint_align = (-1.0, 0.0) self.size_hint_align = (-1.0, 0.0)
self.text = "Proxy configuration"
b = Box(parent) b = Box(parent)
b.size_hint_weight = 1.0, 1.0
proxies = [ proxies = [
["Proxy for torrent peer connections", ["Proxy for torrent peer connections",
@ -246,11 +248,18 @@ class ProxyConfig(Frame):
session.dht_proxy, session.set_dht_proxy], session.dht_proxy, session.set_dht_proxy],
] ]
xbtn = Button(self)
xbtn.text = "<- Back"
xbtn.callback_clicked_add(lambda x: nf.item_pop())
for title, rfunc, wfunc in proxies: for title, rfunc, wfunc in proxies:
pg = ProxyGroup(parent, title, rfunc, wfunc) pg = ProxyGroup(parent, title, rfunc, wfunc)
pg.show() pg.show()
b.pack_end(pg) b.pack_end(pg)
b.pack_end(xbtn)
xbtn.show()
b.show() b.show()
self.content = b self.content = b
@ -268,8 +277,6 @@ class ProxyGroup(Frame):
def __init__(self, parent, title, rfunc, wfunc): def __init__(self, parent, title, rfunc, wfunc):
Frame.__init__(self, parent) Frame.__init__(self, parent)
self.collapse = True
self.autocollapse = True
self.size_hint_weight = 1.0, 0.0 self.size_hint_weight = 1.0, 0.0
self.size_hint_align = -1.0, 0.0 self.size_hint_align = -1.0, 0.0
self.text = title self.text = title
@ -359,8 +366,6 @@ class EncryptionSettings(Frame):
self.session = session self.session = session
Frame.__init__(self, parent) Frame.__init__(self, parent)
self.collapse = True
self.autocollapse = True
self.size_hint_align = -1.0, 0.0 self.size_hint_align = -1.0, 0.0
self.text = "Encryption settings" self.text = "Encryption settings"
@ -542,7 +547,7 @@ class SessionSettings(Scroller):
i += 1 i += 1
xbtn = Button(parent) xbtn = Button(parent)
xbtn.text = "Close" xbtn.text = "<- Back"
xbtn.callback_clicked_add(lambda x: nf.item_pop()) xbtn.callback_clicked_add(lambda x: nf.item_pop())
xbtn.show() xbtn.show()
t.pack(xbtn, 0, i, 2, 1) t.pack(xbtn, 0, i, 2, 1)
@ -631,8 +636,6 @@ class Limits(Frame):
def __init__(self, parent, session): def __init__(self, parent, session):
Frame.__init__(self, parent) Frame.__init__(self, parent)
self.text = "Limits" self.text = "Limits"
self.collapse = True
self.autocollapse = True
self.size_hint_align = -1.0, 0.0 self.size_hint_align = -1.0, 0.0