Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # .py Code:
- class RcGUIApp(App):
- def build(self):
- Window.clearcolor = (0, 0, 0.35, 1)
- sm = ScreenManager()
- sm.add_widget(IntroPage(name="intro_page"))
- sm.add_widget(NewJobPage(name="new_job_page"))
- sm.add_widget(IPMConfirmPage(name = "ipm_confirm_page"))
- return sm
- class IntroPage(Screen):
- def returnCDPath(self):
- global rc
- return str(rc.cd_path)
- def locateDatabase(self):
- global rc
- self.data_label.text = rc.retrieveDatabase()
- def openJob(self):
- #Go to open job page
- pass
- class NewJobPage(Screen):
- def newJob(self):
- global rc
- self.ipm_label.text = "IPM file path: " + str(rc.openIPM())
- rc.makePartList()
- rc.makePoleList()
- def returnCDPath(self):
- global rc
- return str(rc.cd_path)
- def locateDatabase(self):
- global rc
- self.data_label.text = rc.retrieveDatabase()
- def retrieve(self):
- global rc
- rc.getIPM(self.ipm_header.text.upper())
- rc.buildIPM(self.pole_header.text.upper(), self.cd_header.text.upper(), self.conductor_header.text.upper())
- IPMConfirmPage().displayIPM()
- class OpenJobPage(Screen):
- pass
- class IPMConfirmPage(Screen):
- def displayIPM(self):
- for i in range(25):
- self.grid.add_widget(Button(text="you did it!"))
- #.kv Code:
- <IntroPage>:
- data_label: database_label
- BoxLayout:
- orientation: "vertical"
- padding: 10
- spacing: 10
- BoxLayout:
- orientation: "horizontal"
- size_hint: (1, .10)
- Button:
- text: "Locate Database"
- color: (1,1,1,1)
- on_press:
- root.locateDatabase()
- root.data_label.color= (0,1,0,1)
- size_hint_x: (0.05)
- Label:
- id: database_label
- text: root.returnCDPath()
- color: (1,0,0,1)
- size_hint_x: (0.2)
- pos: (.5, .5)
- BoxLayout:
- orientation: "horizontal"
- Button:
- text: "NEW JOB"
- color: (1,1,1,1)
- size_hint: (.45, .10)
- on_press:
- root.manager.transition.direction = "up"
- root.manager.transition.duration = .8
- root.manager.current = "new_job_page"
- Button:
- text: "OPEN JOB"
- color: (1,1,1,1)
- size_hint: (.45, .10)
- pos: (0.5, 0.5)
- on_press: root.openJob()
- <NewJobPage>:
- data_label: database_label
- ipm_label: ipm_name_label
- pole_header: pole_col
- cd_header: cd_col
- conductor_header: conductor_col
- ipm_header: ipm_col
- BoxLayout:
- orientation: "vertical"
- padding: 10
- spacing: 10
- BoxLayout:
- orientation: "horizontal"
- size_hint: (1, .10)
- Button:
- text: "Locate Database"
- color: (1,1,1,1)
- on_press:
- root.locateDatabase()
- root.data_label.color= (0,1,0,1)
- size_hint_x: (0.05)
- Label:
- id: database_label
- text: root.returnCDPath()
- color: (1,0,0,1)
- size_hint_x: (0.2)
- pos: (.5, .5)
- BoxLayout:
- orientation: "horizontal"
- size_hint: (1, .20)
- Button:
- text: "Load IPM"
- color: (1,1,1,1)
- size_hint: (.05, 0.5)
- on_press:
- root.newJob()
- Label:
- id: ipm_name_label
- text: ""
- size_hint: (.2, 0.5)
- BoxLayout:
- orientation: "vertical"
- size_hint: (1, .35)
- Label:
- text: "Enter your Pole, CD# and Conductor column names below:"
- pos_hint: {' center_x': 0.5, 'bottom': 1}
- BoxLayout:
- orientation: "horizontal"
- spacing: 30
- size_hint: (1, 0.35)
- TextInput:
- id: ipm_col
- text: "IPM"
- TextInput:
- id: pole_col
- text: "POLE"
- TextInput:
- id: cd_col
- text: "CD#"
- TextInput:
- id: conductor_col
- text: "CONDUCTOR"
- BoxLayout:
- orientation: "horizontal"
- size_hint: (1, .35)
- Button:
- text: "RETRIEVE"
- pos_hint: {"center_x": .5, "center_y": .5}
- size_hint: (.33, .33)
- color: (1,1,1,1)
- on_press:
- root.retrieve()
- root.manager.transition.direction = "left"
- root.manager.transition.duration = .8
- root.manager.current = "ipm_confirm_page"
- <IPMConfirmPage>:
- grid: Grid
- GridLayout:
- cols: 1
- size_hint_x: 1
- padding: 10
- spacing: 10
- BoxLayout:
- size_hint: (1, 0.1)
- Label:
- text: "IPM"
- Label:
- text: "CD#"
- Label:
- text: "CONDUCTOR"
- ScrollView:
- GridLayout:
- id: Grid
- cols: 3
- height: self.minimum_height
- size_hint: 1, None
- spacing: 50
- padding: 10
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement