Skip to content

Commit

Permalink
Merge pull request #1 from Colorbleed/PLN-0011
Browse files Browse the repository at this point in the history
Avalon Launcher browsing steps
  • Loading branch information
aardschok authored Nov 10, 2017
2 parents f633460 + 561bbd8 commit bedddea
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 22 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,6 @@
*.jsc
*.bat
*.pyc
__pycache__/
__pycache__/

.idea/
49 changes: 33 additions & 16 deletions launcher/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,23 +378,35 @@ def push(self, index):
handler(index)
self.navigated.emit()

@Slot()
def pop(self):
self._frames.pop()
self._model.pop()
@Slot(int)
def pop(self, index=None):

if index is None:
# Regular pop behavior
steps = 1
elif index < 0:
# Refresh; go beyond first index
steps = len(self.breadcrumbs) + 1
else:
# Go to index
steps = len(self.breadcrumbs) - index - 1

if not self.breadcrumbs:
self.popped.emit()
self.navigated.emit()
return self.init()
for i in range(steps):
self._frames.pop()
self._model.pop()

try:
self.breadcrumbs.pop()
except IndexError:
pass
else:
self.popped.emit()
self.navigated.emit()
if not self.breadcrumbs:
self.popped.emit()
self.navigated.emit()
return self.init()

try:
self.breadcrumbs.pop()
except IndexError:
pass
else:
self.popped.emit()
self.navigated.emit()

def init(self):
terminal.log("initialising..")
Expand All @@ -407,7 +419,9 @@ def init(self):
"name": project["name"],
}, **project["data"])
for project in io.projects()
if project.get("active", True)

# Discard hidden projects
if project["data"].get("visible", True)
])

frame = {
Expand Down Expand Up @@ -487,6 +501,9 @@ def on_silo_changed(self, index):
item["name"]
)
)

# Discard hidden items
if doc["data"].get("visible", True)
])

frame["environment"]["silo"] = name
Expand Down
8 changes: 3 additions & 5 deletions launcher/res/qml/Breadcrumbs.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ Item {

ToolButton {
contentItem: AwesomeIcon {
name: "refresh"
name: "home"
size: 12
}

visible: repeater.count == 0

height: parent.height
width: parent.height
onClicked: controller.pop()
onClicked: controller.pop(-1)
}

Repeater {
Expand All @@ -41,7 +39,7 @@ Item {

height: parent.height
font.pixelSize: 10
onClicked: controller.pop()
onClicked: controller.pop(index)
}
}
}
Expand Down

0 comments on commit bedddea

Please sign in to comment.