mirror of
https://git.deluge-torrent.org/deluge
synced 2025-08-11 19:08:40 +00:00
Replace empty lines in InputPopup with generic text(lines are of course still there)
This commit is contained in:
parent
98101ea411
commit
d9789504ff
1 changed files with 15 additions and 8 deletions
|
@ -771,7 +771,7 @@ class InputPopup(Popup):
|
||||||
def __init__(self,parent_mode,title,width_req=-1,height_req=-1,close_cb=None, additional_formatting=True):
|
def __init__(self,parent_mode,title,width_req=-1,height_req=-1,close_cb=None, additional_formatting=True):
|
||||||
Popup.__init__(self,parent_mode,title,width_req,height_req,close_cb)
|
Popup.__init__(self,parent_mode,title,width_req,height_req,close_cb)
|
||||||
self.inputs = []
|
self.inputs = []
|
||||||
self.spaces = []
|
self.lines = []
|
||||||
self.current_input = 0
|
self.current_input = 0
|
||||||
|
|
||||||
self.additional_formatting = additional_formatting
|
self.additional_formatting = additional_formatting
|
||||||
|
@ -808,7 +808,13 @@ class InputPopup(Popup):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def add_spaces(self, num):
|
def add_spaces(self, num):
|
||||||
self.spaces.append((len(self.inputs)-1,num))
|
for i in range(num):
|
||||||
|
self.lines.append((len(self.inputs), ""))
|
||||||
|
|
||||||
|
def add_text(self, string):
|
||||||
|
lines = string.split("\n")
|
||||||
|
for line in lines:
|
||||||
|
self.lines.append( (len(self.inputs), line) )
|
||||||
|
|
||||||
def add_select_input(self, message, name, opts, vals, default_index=0):
|
def add_select_input(self, message, name, opts, vals, default_index=0):
|
||||||
self.inputs.append(SelectInput(self, message, name, opts, vals, default_index,
|
self.inputs.append(SelectInput(self, message, name, opts, vals, default_index,
|
||||||
|
@ -839,9 +845,9 @@ class InputPopup(Popup):
|
||||||
end_row = 0
|
end_row = 0
|
||||||
spos = 0
|
spos = 0
|
||||||
for i, ipt in enumerate(self.inputs):
|
for i, ipt in enumerate(self.inputs):
|
||||||
if self.spaces and (spos < len(self.spaces)) and (i == self.spaces[spos][0]):
|
for line in self.lines:
|
||||||
end_row += self.spaces[spos][1]
|
if line[0] == i:
|
||||||
spos += 1
|
end_row += 1
|
||||||
start_row = end_row
|
start_row = end_row
|
||||||
end_row += ipt.get_height()
|
end_row += ipt.get_height()
|
||||||
active = (i == self.current_input)
|
active = (i == self.current_input)
|
||||||
|
@ -856,10 +862,11 @@ class InputPopup(Popup):
|
||||||
crow = 1 - self.lineoff
|
crow = 1 - self.lineoff
|
||||||
spos = 0
|
spos = 0
|
||||||
for i,ipt in enumerate(self.inputs):
|
for i,ipt in enumerate(self.inputs):
|
||||||
|
for line in self.lines:
|
||||||
|
if line[0] == i:
|
||||||
|
self.add_string(crow, line[1], self.screen, 1, pad=False)
|
||||||
|
crow += 1
|
||||||
crow += ipt.render(self.screen,crow,self.width,i==self.current_input)
|
crow += ipt.render(self.screen,crow,self.width,i==self.current_input)
|
||||||
if self.spaces and (spos < len(self.spaces)) and (i == self.spaces[spos][0]):
|
|
||||||
crow += self.spaces[spos][1]
|
|
||||||
spos += 1
|
|
||||||
|
|
||||||
if (self.content_height > (self.height-2)):
|
if (self.content_height > (self.height-2)):
|
||||||
lts = self.content_height-(self.height-3)
|
lts = self.content_height-(self.height-3)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue