Now allows to reorder the files

Also allows to reorder both titles and files with drag'n'drop
This commit is contained in:
Sergio Costas 2014-07-11 23:26:32 +02:00
parent 1299c83991
commit ba7beb5a3f
4 changed files with 31 additions and 2 deletions

View file

@ -30,4 +30,5 @@ class file(GObject.GObject):
def properties(self):
self.file_name = "Hola"
self.file_name = "Hola"+str(self.counter2)
self.counter2 += 1

View file

@ -181,6 +181,16 @@ class devede_project:
self.wliststore_titles.swap(last_element.iter,treeiter)
self.set_interface_status(None)
def on_up_file_clicked(self,b):
(element, position, model, treeiter) = self.get_current_file()
if (element == None) or (position == 0):
return
last_element = self.wfiles.get_model()[position-1]
self.wfiles.get_model().swap(last_element.iter,treeiter)
self.set_interface_status(None)
def on_down_title_clicked(self,b):
(element, position, model, treeiter) = self.get_current_title()
@ -191,6 +201,16 @@ class devede_project:
self.wliststore_titles.swap(last_element.iter,treeiter)
self.set_interface_status(None)
def on_down_file_clicked(self,b):
(element, position, model, treeiter) = self.get_current_file()
if (element == None) or (position == (len(self.wfiles.get_model())-1)):
return
last_element = self.wfiles.get_model()[position+1]
self.wfiles.get_model().swap(last_element.iter,treeiter)
self.set_interface_status(None)
def get_current_title(self):
""" returns the currently selected title """