Guest User

Untitled

a guest
Aug 18th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.82 KB | None | 0 0
  1. def Lnlau(self): #LNLAU = Load_Nodeid_List_And_Update
  2. FRM = open('NodeidList.txt', 'r') #FileReadMode
  3.  
  4. while True:
  5. for i, l in enumerate(FRM):
  6. if (i)%2 == 1: #1 , 3 ,5 ,7...
  7. l_new = l.rstrip('n')
  8. FSM = l_new
  9.  
  10. linecontents = BusInfo_Update()
  11. linecontents.Update(FSM) #BusInfo_Update().Update(FSM) eg) FSM = 'ICB23221.txt'
  12. else:
  13. pass
  14.  
  15. __version__ = "1.0"
  16. #-*- coding: utf-8 -*-
  17.  
  18. import kivy
  19. import os
  20. kivy.require('1.10.0')
  21. from kivy.app import App
  22. from kivy.lang import Builder
  23. from kivy.uix.screenmanager import ScreenManager, Screen
  24. from kivy.uix.boxlayout import BoxLayout
  25. from kivy.uix.gridlayout import GridLayout
  26. from kivy.uix.image import Image
  27. from kivy.uix.label import Label
  28. from kivy.animation import Animation
  29. from kivy.clock import Clock
  30. #from kivy.config import Config #windows size fixed
  31. #Config.set('graphics', 'resizable', 0)
  32. from kivy.core.window import Window
  33. Window.size = (1080, 1920)
  34. ##########FOR BUS INFORMATION UPDATE#############
  35. from urllib import urlencode, quote_plus
  36. from urllib2 import Request as RQ
  37. from urllib2 import urlopen as UO
  38. import urllib
  39. import xml.etree.ElementTree as etree
  40. import os
  41. import datetime
  42.  
  43. class Loading_Screen(Screen):
  44. def __init__(self, **kwargs):
  45. super(Loading_Screen, self).__init__(**kwargs)
  46. Clock.schedule_once(self.callNext, 2)
  47.  
  48. def callNext(self,dt):
  49. self.manager.current = 'Before_First_Screen'
  50.  
  51. class Load_BusInfo():
  52. pass
  53.  
  54. class Before_First_Screen(Screen):
  55. pass
  56.  
  57. class First_Screen(Screen):
  58. pass
  59.  
  60. class Test_Screen(Screen):
  61. pass
  62.  
  63. ###################destination_station_name#####################
  64.  
  65. class DTN_TECHNOPARK(Screen):
  66. pass
  67.  
  68. class DTN_BITZONE(Screen):
  69. pass
  70.  
  71. class DTN_INUSTATION(Screen):
  72. pass
  73.  
  74. class Bus_Information(Screen):
  75. def __init__(self, **kwargs):
  76. super(Bus_Information, self).__init__(**kwargs)
  77. #oo = os.path.join('/data/data/org.test.tubuc/files/app/station/', 'ICB164000039.txt')
  78. oo = os.path.join('/root/hi/station/', 'ICB164000039.txt')
  79. with open(oo) as businfo:
  80. Businfo= []
  81. nolinenum=businfo.readline()
  82. while nolinenum!='':
  83. Businfo.append(nolinenum)
  84. leftstations = (businfo.readline().rstrip('n') + ' stations'.rstrip('n'))
  85. lefttime = (businfo.readline().rstrip('n') + ' seconds'.rstrip('n'))
  86. nolinenum = businfo.readline().rstrip('n')
  87. Businfo.append(leftstations)
  88. Businfo.append(lefttime)
  89. self.businfolist = Businfo
  90. self.lenbil = int(len(Businfo))
  91. self.numberoflist = int(len(Businfo)/3)
  92.  
  93. class ScreenManagement(ScreenManager):
  94. pass
  95.  
  96. presentation = Builder.load_file("main.kv")
  97.  
  98. class TubucApp(App):
  99. def build(self):
  100. return presentation
  101.  
  102.  
  103. TubucApp().run()
  104.  
  105. # -*- coding: utf-8 -*-
  106. #:import NoTransition kivy.uix.screenmanager.NoTransition
  107. #:import Label kivy.uix.button.Label
  108.  
  109. ScreenManagement:
  110. transition: NoTransition()
  111. Loading_Screen:
  112. Before_First_Screen:
  113. First_Screen:
  114. Test_Screen:
  115. DTN_TECHNOPARK:
  116. DTN_BITZONE:
  117. DTN_INUSTATION:
  118. Bus_Information:
  119.  
  120. <Loading_Screen>:
  121. name: 'Loading_Screen'
  122. canvas:
  123. Rectangle:
  124. pos: self.pos
  125. size: self.size
  126. source: 'image/Loading_Screen.png'
  127.  
  128. <Before_First_Screen>:
  129. name: 'Before_First_Screen'
  130. Button:
  131. canvas:
  132. Rectangle:
  133. pos: self.pos
  134. size: self.size
  135. source: 'image/BBG2.png'
  136. on_release:
  137. app.root.current = 'First_Screen'
  138.  
  139. <First_Screen>:
  140. name: 'First_Screen'
  141.  
  142. BoxLayout:
  143. orientation: 'horizontal'
  144. spacing: 50 # spacing between button
  145. padding: [50, 50, 50, 50]
  146. canvas:
  147. Rectangle:
  148. pos: self.pos
  149. size: self.size
  150. source: 'image/background.png' #backgroundimage
  151. Button:
  152. id: dongmak
  153. width: 40
  154. pos_hint: {'x' : 0, 'y':.45}
  155. size_hint: [.6,.1]
  156. background_normal:'image/2.png'
  157. background_down:'image/after.png'
  158. border: (0,0,0,0)
  159. on_release: app.root.current = 'Bus_Information'
  160. Button:
  161. id: campustown
  162. color: 100,100,100,100 #text_color
  163. width: 40
  164. pos_hint: {'x' : 0, 'y':.45}
  165. size_hint: [.6,.1]
  166. background_normal:'image/3.png'
  167. background_down:'image/after.png'
  168. border: (0,0,0,0)
  169. on_release: app.root.current = 'DTN_BITZONE'
  170. Button:
  171. id: technopark
  172. color: 100,100,100,100 #text_color
  173. pos_hint: {'x' : 0, 'y':.45}
  174. size_hint: [.6,.1]
  175. background_normal:'image/4.png'
  176. background_down:'image/after.png'
  177. border: (0,0,0,0)
  178. on_release: app.root.current = 'DTN_INUSTATION'
  179. Button:
  180. id: bitzone
  181. width: 40
  182. pos_hint: {'x' : 0, 'y':.45}
  183. size_hint: [.6,.1]
  184. background_normal:'image/5.png'
  185. background_down:'image/after.png'
  186. border: (0,0,0,0)
  187. Button:
  188. id: inustation
  189. width: 40
  190. pos_hint: {'x' : 0, 'y':.45}
  191. size_hint: [.6,.1]
  192. background_normal:'image/1.png'
  193. background_down:'image/after.png'
  194. border: (0,0,0,0)
  195. #font_size: 15
  196. #text: 'inustation'
  197. <Test_Screen>:
  198. name: 'Test_Screen'
  199.  
  200. Button:
  201. on_release: app.root.current = 'First_Screen'
  202. text: 'back to the home screen'
  203. font_size: 50
  204.  
  205. ############destionation_station_name################
  206. <DTN_TECHNOPARK>:
  207. name: 'DTN_TECHNOPARK'
  208.  
  209. Button:
  210. on_release: app.root.current = 'First_Screen'
  211. text: 'destionation >> technopark'
  212. font_size: 50
  213.  
  214. <DTN_BITZONE>:
  215. name: 'DTN_BITZONE'
  216.  
  217. Button:
  218. on_release: app.root.current = 'First_Screen'
  219. text: 'destionation >> bitzone'
  220. font_size: 50
  221.  
  222. <DTN_INUSTATION>:
  223. name: 'DTN_INUSTATION'
  224.  
  225. Button:
  226. on_release: app.root.current = 'First_Screen'
  227. text: 'destionation >> inustation'
  228. font_size: 50
  229. ######################################################
  230. <Bus_Information>:
  231. name: 'Bus_Information'
  232. canvas:
  233. Rectangle:
  234. pos: self.pos
  235. size: self.size
  236. source: 'image/BBG.png' #backgroundimage
  237.  
  238. #for sero in range(root.numberoflist):
  239. # for garo in range(3):
  240.  
  241.  
  242. GridLayout:
  243. cols: 3
  244. rows: root.numberoflist
  245. spacing: 0
  246. padding: [0,100]
  247. on_parent:
  248. for i in range(root.lenbil): txt = root.businfolist[i]; self.add_widget(Label(text = txt, text_size=(cm(2), cm(2)),
  249. pos=self.pos, id=txt))
Add Comment
Please, Sign In to add comment