Advertisement
Narzew

Terquel Source v 0.01 NOT WORKING

Sep 26th, 2014
310
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.66 KB | None | 0 0
  1. #encoding: utf-8
  2. from kivy.app import App
  3. from kivy.lang import Builder
  4. from kivy.uix.boxlayout import BoxLayout
  5. from kivy.uix.label import Label
  6. from kivy.uix.button import Button
  7. from kivy.uix.screenmanager import ScreenManager, Screen
  8. from kivy.uix.checkbox import CheckBox
  9. from kivy.uix.scrollview import ScrollView
  10. from kivy.properties import StringProperty
  11. import random
  12. import zlib
  13. import os.path
  14. import marshal
  15. import time
  16.  
  17. class MainScreen(Screen):
  18.    
  19.     pass
  20.    
  21. class ScrollableLabel(ScrollView):
  22.     text = StringProperty("")
  23.  
  24. class Terquel(App):
  25.    
  26.     def read_presentation(self):
  27.         file = open("main.tq", "rb")
  28.         presentation_data = file.read()
  29.         file.close()
  30.         presentation_data = presentation_data.split("\n")
  31.         currentslide = 1
  32.         for i in presentation_data:
  33.             cmd = i.split(" ")
  34.             if cmd[0] == "slides":
  35.                 slidesnr = int(cmd[1])
  36.                 # Make a class for each slide
  37.                 for i in range(1,slidesnr):
  38.                     self.manager.add_widget(Screen(id="Slide"+str(i)))
  39.             elif cmd[0] == "slide":
  40.                 currentslide = int(cmd[1])
  41.             elif cmd[0] == "label":
  42.                 labelid = str(cmd[1])
  43.                 cmd[0] = ""
  44.                 cmd[1] = ""
  45.                 labeltext = "".join(cmd)
  46.                 nextlabel = Label(id=labelid, text=labeltext)
  47.                 self.ids["Slide"+str(currentslide)].add_widget(nextlabel)
  48.             elif cmd[0] == "image":
  49.                 imageid = str(cmd[1])
  50.                 imagesrc = str(cmd[2])
  51.                 nextimage = Image(id=imageid,source=imagesrc)
  52.                 self.ids["Slide"+str(currentslide)].add_widget(nextimage)
  53.    
  54.     def build(self):
  55.         Builder.load_file("main.kv")
  56.         sm = ScreenManager()
  57.         sm.add_widget(MainScreen(name='main'))
  58.         self.read_presentation()
  59.         return sm
  60.    
  61. if __name__ == "__main__":
  62.     Terquel().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement