-
Notifications
You must be signed in to change notification settings - Fork 0
/
PageBase.py
91 lines (74 loc) · 2.11 KB
/
PageBase.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import soco
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk
from abc import ABCMeta, abstractmethod
class PageBase(Gtk.VBox):
__metaclass__=ABCMeta
# @abstractmethod
def on_zoneButton_Clicked(self):
self.topLevel.show_page("ZonesPage")
def on_musicButton_Clicked(self):
if self.topLevel.pageInView == self.topLevel.pageDict["MusicPage"]:
self.topLevel.show_page("MusicPlayingPage")
else:
self.topLevel.show_page("MusicPage")
def on_Page_Exit_View(self):
self.pageInView = False
def on_Page_Entered_View(self, selectedZone):
self.pageInView = True
self.selectedZone = selectedZone
# The row of buttons at the bottom of the screen
@abstractmethod
def on_Button_A_Clicked(self):
pass
@abstractmethod
def on_Button_B_Clicked(self):
pass
@abstractmethod
def on_Button_C_Clicked(self):
pass
@abstractmethod
def on_Return_Button_Clicked(self):
pass
# The scroll wheel
@abstractmethod
def on_Scroll_Up(self):
pass
@abstractmethod
def on_Scroll_Down(self):
pass
@abstractmethod
def on_Button_Ok_Clicked(self):
pass
@abstractmethod
def title(self):
pass
@abstractmethod
def scrolledWindow(self):
pass
@abstractmethod
def status(self):
pass
@abstractmethod
def footer(self):
pass
# def set_top_level(self, tl):
# self.topLevel = tl
def __init__(self, topLevel):
super().__init__(self, Gtk.Orientation.HORIZONTAL, 6)
# Initialize data members
self.topLevel = topLevel
self.selectedZone = None
self.fromPage = None
self.pageInView = False
# Build the basic GUI structure of
# the interface pages.
self.set_homogeneous(False)
self.pack_start(self.title(), False, False, 0)
self.pack_start(self.scrolledWindow(), True, True, 1)
self.statusGrid = self.status()
if self.statusGrid is not None:
self.pack_start(self.status(), False, False, 0)
self.pack_start(self.footer(), False, False, 0)
self.show_all()