Skip to content

Commit

Permalink
Merge pull request #1 from IamDH4/feature-newgui-bugfix-listorder
Browse files Browse the repository at this point in the history
Fixed component list not affecting render order.  FIXME Reverse the r…
  • Loading branch information
DH4 authored May 28, 2017
2 parents d9641d8 + b2e3716 commit 6433f6d
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,24 +315,30 @@ def changeComponentWidget(self):
def moveComponentUp(self):
row = self.window.listWidget_componentList.currentRow()
if row > 0:
item = self.window.listWidget_componentList.takeItem(row)
self.window.listWidget_componentList.insertItem(row - 1, item)
module = self.selectedComponents[row]
self.selectedComponents.pop(row)
self.selectedComponents.insert(row - 1,module)
page = self.pages[row]
self.pages.pop(row)
self.pages.insert(row - 1, page)
item = self.window.listWidget_componentList.takeItem(row)
self.window.listWidget_componentList.insertItem(row - 1, item)
widget = self.window.stackedWidget.removeWidget(page)
self.window.stackedWidget.insertWidget(row - 1, page)
self.window.listWidget_componentList.setCurrentRow(row - 1)
self.window.stackedWidget.setCurrentIndex(row -1)

def moveComponentDown(self):
row = self.window.listWidget_componentList.currentRow()
if row < len(self.pages):
item = self.window.listWidget_componentList.takeItem(row)
self.window.listWidget_componentList.insertItem(row + 1, item)
if row < len(self.pages) + 1:
module = self.selectedComponents[row]
self.selectedComponents.pop(row)
self.selectedComponents.insert(row + 1,module)
page = self.pages[row]
self.pages.pop(row)
self.pages.insert(row + 1, page)
item = self.window.listWidget_componentList.takeItem(row)
self.window.listWidget_componentList.insertItem(row + 1, item)
widget = self.window.stackedWidget.removeWidget(page)
self.window.stackedWidget.insertWidget(row + 1, page)
self.window.listWidget_componentList.setCurrentRow(row + 1)
Expand Down

0 comments on commit 6433f6d

Please sign in to comment.