Esempio n. 1
0
 def __init__(self,**kwargs):
     Screen.__init__(self,**kwargs)
     self.log = kwargs['log']
     
     self.status_display = None
     self.display_limit = 100
     self.visible = False
Esempio n. 2
0
File: main.py Progetto: yeellow/noGo
 def rebuild_homescreen(self, mode=None, goto=True):
     print "rebuilding homescreen"
     t1 = time()
     if mode is None:
         mode = self.view_mode
     if "Home" in self.screen_names:
         oldhome = self.get_screen("Home")
         self.remove_widget(oldhome)
     if mode[:6] == "tablet":
         hs = TabletHomeScreen(managedby=self)
     else:
         hs = HomeScreen(managedby=self)
     t2 = time()
     print "made homescreen", t2 - t1
     hs_screen = Screen(name="Home")
     hs_screen.add_widget(hs)
     t3 = time()
     self.add_widget(hs_screen)
     print "made Screen", t3 - t2
     self.refresh_open_games()
     t4 = time()
     print "refreshed open games", t4 - t3
     print "total", t4 - t1
     if goto:
         if self.current == "Home":
             self.make_empty_screen()
             self.current = "emptyscreen"
         self.current = "Home"
Esempio n. 3
0
 def build(self):
     Builder.load_string(textwrap.dedent(
     '''
         <CustomButtonClass@Button>:
             description_a: ''
             description_b: ''
             text: root.description_a + ' <newline> ' + root.description_b
             halign:'center'
             size_hint:(1, 0.1)
         <MyListView>:
             size_hint:(0.5, 0.5)
             ListView:
                 item_strings: [str(index) for index in range(10)]
         <OtherNamedScreen>:
             GridLayout:
                 cols: 2
                 MyListView
                 ScrollView:
                     ContainerForButtons:
                         cols:1
                         row_default_height:150
                         size_hint_y: None
     '''))
     Window.bind(on_keyboard=self.check_what_key_was_pressed)
     self.screen_mgr = ScreenManager()
     first = Screen(name='First')
     self.screen_mgr.add_widget(first)
     first.add_widget(Button(text="click me", bind=self.swap_screen))
     self.screen_mgr.add_widget(OtherNamedScreen(name='Second'))
     return self.screen_mgr
Esempio n. 4
0
	def __init__(self, n_procesadores, **kwargs):

		Builder.load_file(kwargs['archivo'])

		Screen.__init__(self, **kwargs)

		self.procesadores = None
		self.tabla_procesos = None
		self.popup_proceso = None

		self.inicializar(n_procesadores)

		self.tabla_procesos = self.tabla_procesos or TablaProcesosGUI(self.sistema.procesos)
		self.procesadores = self.procesadores or [ProcesadorGUI(p, self.tabla_procesos) for p in self.sistema.procesadores]
		
		self.popup_proceso = self.popup_proceso or ProcesoPopup(self.sistema)

		self.ids.titulo.text = "Simulacion para "+self.name
		
		self.popup_recurso = RecursoPopup(self.sistema)
		self.tabla_recursos = TablaRecursosGUI(self.sistema.recursos)

		self.ejecutando = False
		self.paso = False

		for p in self.procesadores:
			self.ids.procesadores.add_widget(p)

		self.c_procesos.add_widget(self.tabla_procesos)
		self.c_recursos.add_widget(self.tabla_recursos)

		self.sistema.asignar_vista(self)
Esempio n. 5
0
 def __init__(self):
     Screen.__init__(self)
     self.name = 'file'
     
     self.file_chooser = FileChooserListView(path=os.getcwd())
     self.file_chooser.bind(on_submit=self.add_cards)
     self.add_widget(self.file_chooser)
Esempio n. 6
0
 def __init__(self):
     Screen.__init__(self)
     self.name = 'menu'
     self.config = ConfigParser()
     self.config.add_section("deck")
     self.config.add_section("card")
     self.config.adddefaultsection("menu")
     self.config.set("deck", "start_studying", 1)
     self.config.set("deck", "change_deck_mode", "Normal")
     self.config.set("deck", "show_list", True)
     self.config.set("deck", "undo", True)
     self.config.set("deck", "redo", True)
     self.config.set("card", "add", "")
     self.config.set("card", "edit", True)
     self.config.set("card", "remove", True)
     
     self.config.add_callback(self.check_deck_locks, "deck", "redo")
     self.config.add_callback(self.check_deck_locks, "deck", "undo")
     
     self.config.add_callback(self.check_card_locks, "card", "edit")
     self.config.add_callback(self.check_card_locks, "card", "add")
     
     
     self.menu = SettingsWithNoMenu()
     self.menu.register_type("screen", FlashcardAppManager.SettingNewScreen)
     self.menu.register_type("action", FlashcardAppManager.SettingDoAction)
     self.menu.add_json_panel("Flashcards", self.config, os.path.join(os.path.dirname(__file__), 'menu.json'))
     
     self.add_widget(self.menu)
Esempio n. 7
0
    def __init__(self, **kwargs):
        """

        :param kwargs:
        :return:
        """
        super(GameApp, self).__init__(**kwargs)
        self.textures = textures
        self.authorizations = authorizations
        self.my_event_dispatcher = MenusEventDispatcher()
        self.screen_manager = ScreenManager()

        self.menu_widget = Menu(self.my_event_dispatcher)
        self.menu_screen = Screen(name="Menu")
        self.menu_screen.add_widget(self.menu_widget)
        self.screen_manager.add_widget(self.menu_screen)

        self.game_widget = LevelManager()
        self.game_screen = Screen(name="LevelManager")
        self.game_screen.add_widget(self.game_widget)
        self.screen_manager.add_widget(self.game_screen)

        self.menu_level_widget = MenuLevel(self.my_event_dispatcher)
        self.menu_level_screen = Screen(name="MenuLevel")
        self.menu_level_screen.add_widget(self.menu_level_widget)
        self.screen_manager.add_widget(self.menu_level_screen)

        self.my_event_dispatcher.bind(on_change_screen=self.do_change_screen)
Esempio n. 8
0
    def __init__(self, player_file=None, **kwargs):
        Screen.__init__(self, **kwargs)        
        self.purchased = []
        if player_file is None:
            self._purchased_file = os.path.join("player", "backgrounds.txt")
        else: self._purchased_file = player_file
        self._read_purchased()
        self.purchased_cat = BackgroundCategory('Purchased')
        
        self.categories = []
        self._available_file = os.path.join("data", "Backgrounds.txt")
        self._read_available()

        layout = BoxLayout(orientation="vertical")
        layout.add_widget(ActionBar(size_hint=(1, .125)))
        scroller = ScrollView(do_scroll_x=False)
        self.grid = GridLayout(cols=1, size_hint_y=None)
        self.grid.add_widget(CategoryIcon(screen=self,
                                          category=self.purchased_cat))
        self.bind(size=self._resize_grid)
        for cat in self.categories:
            self.grid.add_widget(CategoryIcon(screen=self,
                                              category=cat))
        scroller.add_widget(self.grid)
        layout.add_widget(scroller)
        self.add_widget(layout)
Esempio n. 9
0
 def __init__(self, title, *args, **kwargs):
     """
         @title - tytul (nazwa) cwiczenia
     """
     Builder.load_file("kv/genericlevels.kv")
     Screen.__init__(self, *args, **kwargs)
     self.title = title
Esempio n. 10
0
    def __init__(self, **kwargs):
        """

        :param kwargs:
        :rtype: void
        """
        super(GameApp, self).__init__(**kwargs)

        self.menu_screen = Screen(name="Menu")
        self.menu_level_screen = Screen(name="MenuLevel")
        self.game_screen = Screen(name="LevelManager")

        self.menu_widget = Menu(self.menus_event_dispatcher, self.music_provider)
        self.menu_screen.add_widget(self.menu_widget)
        self.screen_manager.add_widget(self.menu_screen)

        self.game_widget = LevelManager(self.menus_event_dispatcher, self.music_provider)
        self.game_screen.add_widget(self.game_widget)
        self.screen_manager.add_widget(self.game_screen)

        self.menu_level_widget = MenuLevel(self.menus_event_dispatcher)
        self.menu_level_screen.add_widget(self.menu_level_widget)
        self.screen_manager.add_widget(self.menu_level_screen)

        self.menus_event_dispatcher.bind(on_change_screen=self.do_change_screen)
Esempio n. 11
0
    def __init__(self, name=""):
        Screen.__init__(self, name=name)

        self.layout = FloatLayout()

        self.color = Label(text="Pick a Color or Animation",
                           pos_hint={'x': 0, 'y': .67},
                           size_hint=(1, .33),
                           font_size=32)

        self.animations = Button(text="Pick Animation",
                                 pos_hint={'x': 0, 'y': .34},
                                 size_hint=(1, .33),
                                 font_size=32)

        self.sliders = Button(text="Custom Color",
                              pos_hint={'x': 0, 'y': 0},
                              size_hint=(.5, .34),
                              font_size=32)

        self.main = Button(text="Return",
                           pos_hint={'x': .5, 'y': 0},
                           size_hint=(.5, .34),
                           font_size=32)

        self.main.bind(on_release=self.go_to_main)
        self.sliders.bind(on_release=self.go_to_sliders)
        self.animations.bind(on_release=self.go_to_anims)

        self.layout.add_widget(self.color)
        self.layout.add_widget(self.animations)
        self.layout.add_widget(self.sliders)
        self.layout.add_widget(self.main)

        self.add_widget(self.layout)
Esempio n. 12
0
    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)

        # Prepare the display areas
        self.gameboard = BoardDisplay(board=self.game.board,
                                      size_hint=(4, 1))
        self.round_counter = RoundCounter(round_number=self.game.round,
                                          max_round=GameSettings.NUM_ROUNDS,
                                          size_hint=(1, .075))
        self.scoreboard = ScoreDisplay(scoreboard=self.game.score,
                                       size_hint=(1, .4))
        self.tooltip = ToolTipDisplay(size_hint=(1, .5))
        self.hand_display = HandDisplay(hand=self.game.players[PLAYER],
                                        size_hint=(1, .3))

        # Lay out the display
        main = BoxLayout(orientation="vertical")
        layout = BoxLayout()
        layout.add_widget(self.gameboard)
        sidebar = BoxLayout(orientation="vertical")
        sidebar.add_widget(self.round_counter)
        sidebar.add_widget(self.scoreboard)
        sidebar.add_widget(self.tooltip)
        layout.add_widget(sidebar)
        main.add_widget(layout)
        main.add_widget(self.hand_display)
        self.add_widget(main)
Esempio n. 13
0
 def build(self):
   self.sm = TouchyScreenManager()
   for storyline in intro.splitlines():
     screen = Screen(name=storyline)
     screen.add_widget(Label(text=storyline))
     self.sm.add_widget(screen)
   return self.sm
Esempio n. 14
0
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     main = BoxLayout(orientation="vertical")
     main.add_widget(ActionBar(size_hint=(1, .125)))
     carousel = Carousel(direction='right')
     layout = GridLayout(rows=2)
     i, c = 0, 0
     for card in self.definition.cards(App.get_running_app().achievements,
                                       use_blocks=False):
         color = (1, 1, 1, 1)
         if str(card) in self.definition.blocked_cards:
             color = (.5, 0, 0, 1)
         layout.add_widget(CardSelect(card=card,
                                      color=color,
                                      callback=self._card_detail,
                                      args=(card,)))
         i += 1
         c += 1
         if i == 10:
             carousel.add_widget(layout)
             layout = GridLayout(rows=2)
             i = 0
     if c < 50 + len(self.definition.specials):
         layout.add_widget(CardSelect(card=self.LOCKED_CARD))
     carousel.add_widget(layout)
     main.add_widget(carousel)
     self.add_widget(main)
Esempio n. 15
0
    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)
        self.tryout = StackLayout(orientation ='lr-bt') 
        self.floatt = FloatLayout()

        #variable for gettinginformation()
        self.counter = 0
        # Title of the screen
        self.floatt.add_widget(Label(text='[color=000000][size=40][font=yorkwhiteletter]EBOTS INFORMATION[/font][/size][/color]', size_hint=(0.5,0.2),markup=True,pos_hint={'x':0.05,'y':0.8}))
    
        #information on ebots with 'good' status 
        self.ebotgoodpic = Image(source='C:\Users\The Gt Zan\Pictures\ebotinfo.PNG')
        self.floatt.add_widget(self.ebotgoodpic)    

        #buttons at the bottom 
        self.switchtomenu = Button(text='[size=50][font=yorkwhiteletter][color=000000]MENU[/font][/size][/color]',markup=True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToMenu)
        self.switchtoebot = Button(text='[size=50][font=yorkwhiteletter][color=000000]EBOTS[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToebots)
        self.switchtopersonal = Button(text='[size=50][font=yorkwhiteletter][color=000000]INDIVIDUAL[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToPersonal)
        self.tryout.add_widget(self.switchtoebot)
        self.tryout.add_widget(self.switchtopersonal)
        self.tryout.add_widget(self.switchtomenu)

        #getting information 
        self.refresh=Button(text='[size=50][font=yorkwhiteletter][color=000000]REFRESH[/font][/size][/color]', markup = True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.gettinginformation)
        self.tryout.add_widget(self.refresh)

        #add layouts
        self.add_widget(self.tryout)
        self.add_widget(self.floatt)
Esempio n. 16
0
 def rebuild_homescreen(self, mode=None, goto=True):
     print 'rebuilding homescreen'
     t1 = time()
     if mode is None:
         mode = self.view_mode
     if 'Home' in self.screen_names:
         oldhome = self.get_screen('Home')
         self.remove_widget(oldhome)
     if mode[:6] == 'tablet':
         hs = TabletHomeScreen(managedby=self)
     else:
         hs = HomeScreen(managedby=self)
     t2 = time()
     print 'made homescreen', t2-t1
     hs_screen = Screen(name='Home')
     hs_screen.add_widget(hs)
     t3 = time()
     self.add_widget(hs_screen)
     print 'made Screen', t3-t2
     self.refresh_open_games()
     t4 = time()
     print 'refreshed open games', t4-t3
     print 'total', t4-t1
     if goto:
         if self.current == 'Home':
             self.make_empty_screen()
             self.current = 'emptyscreen'
         self.current = 'Home'
Esempio n. 17
0
 def display_settings(self, settings):
     manager = self.manager
     if not manager.has_screen('Settings'):
         s = Screen(name='Settings')
         s.add_widget(settings)
         manager.add_widget(s)
     manager.switch_and_set_back('Settings')
Esempio n. 18
0
class GameApp(App):
    def __init__(self, **kwargs):
        """

        :param kwargs:
        :return:
        """
        super(GameApp, self).__init__(**kwargs)
        self.textures = textures
        self.screen_manager = ScreenManager()

        self.menu_widget = Menu()
        self.menu_screen = Screen(name="Menu")
        self.menu_screen.add_widget(self.menu_widget)
        self.screen_manager.add_widget(self.menu_screen)

        self.game_widget = Level('../resources/test.png', self.textures)
        self.game_screen = Screen(name="Game")
        self.game_screen.add_widget(self.game_widget)
        self.screen_manager.add_widget(self.game_screen)

    def build(self):
        """

        :return:
        """
        self.screen_manager.current = 'Game'
        return self.screen_manager
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     self.layout = BoxLayout()
     # self.btnQuit = Button(text='Quit now!',on_press=app.quitApp)
     # self.add_widget(self.btnQuit)
     # Add your code below to add the two Buttons
     pass
Esempio n. 20
0
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     layout = BoxLayout(orientation="vertical")
     layout.add_widget(ActionBar(size_hint=(1, .125)))
     settings = SettingsWithNoMenu(size_hint=(1, .875))
     App.get_running_app().build_settings(settings)
     layout.add_widget(settings)
     self.add_widget(layout)
Esempio n. 21
0
 def __init__(self):
     Screen.__init__(self)
     self.name = 'deck'
     self.box_layout = BoxLayout(size=Window.size)
     self.add_widget(self.box_layout)
     
     FlashcardAppManager.deck_widget = DeckWidget()
     self.box_layout.add_widget(FlashcardAppManager.deck_widget)
Esempio n. 22
0
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
     layout = BoxLayout(orientation="vertical")
     layout.add_widget(ActionBar(size_hint=(1, .125)))
     self.main = StatisticsDisplay(statistics=self.statistics,
                                   deck=App.get_running_app().loaded_deck)
     layout.add_widget(self.main)
     self.add_widget(layout)
Esempio n. 23
0
    def __init__(self, name="", custom_manager=None):
        Screen.__init__(self, name=name)

        self.current_page = 1

        self.obd_manager = custom_manager

        self.layout = FloatLayout()

        self.values = [Label(text="OBD", size_hint=(.5, .30), pos_hint={'x': 0, 'y': .6}, font_size=32),

                       Label(text="OBD2", size_hint=(.5, .30),
                             pos_hint={'x': .5, 'y': .6}, font_size=32),

                       Label(text="OBD3", size_hint=(.5, .30),
                             pos_hint={'x': 0, 'y': .20}, font_size=32),

                       Label(text="OBD4", size_hint=(.5, .30),
                             pos_hint={'x': .5, 'y': .20}, font_size=32)
                       ]

        self.types = [Label(text="FILLER",
                            size_hint=(.5, .1),
                            pos_hint={'x': 0, 'y': .9},
                            font_size=32),

                      Label(text="FILLER",
                            size_hint=(.5, .1),
                            pos_hint={'x': .5, 'y': .9},
                            font_size=32),

                      Label(text="FILLER",
                            size_hint=(.5, .1),
                            pos_hint={'x': 0, 'y': .5},
                            font_size=32),

                      Label(text="FILLER",
                            size_hint=(.5, .1),
                            pos_hint={'x': .5, 'y': .5},
                            font_size=32)
                      ]

        self.change = Button(
            text="Change OBD", size_hint=(.5, .20), pos_hint={'x': 0, 'y': 0}, font_size=32)
        self.main = Button(
            text="Return", size_hint=(.5, .20), pos_hint={'x': .5, 'y': 0}, font_size=32)

        self.change.bind(on_press=self.switch_commands)
        self.main.bind(on_release=self.go_to_parent)

        for i in range(4):
            self.layout.add_widget(self.values[i])
            self.layout.add_widget(self.types[i])

        self.layout.add_widget(self.change)
        self.layout.add_widget(self.main)

        self.add_widget(self.layout)
Esempio n. 24
0
 def get_more_info(self, info):
     if not App.get_running_app().root.has_screen(info.memory['sid']):
         sc = Screen(name=info.memory['sid'])
         m = MoreInfo(info.memory)
         sc.add_widget(m)
         App.get_running_app().root.add_widget(sc)
         self.used_screens.append(info.memory['sid'])
     App.get_running_app().root.transition = RiseInTransition()
     App.get_running_app().root.current = info.memory['sid']
Esempio n. 25
0
 def add_page(self, id, name):      
     screen = Screen()
     screen.name = id
     page = AudiowallPage()
     page.name = name
     screen.add_widget(page)
     self._sm.add_widget(screen)
     self.pages.append(page)
     self.pages_label.text = 'Page %i of %i' % (self.active_page, len(self.pages))
Esempio n. 26
0
    def __init__(self, **kwargs):
        Screen.__init__(self, **kwargs)
        Window.clearcolor=(1,1,1,1) #change master bg colour, RGB in .% , last is a binary: 1 = On, 0 = Off . Currently the colour is white
        #Layouts
        self.tryout = StackLayout(orientation ='lr-bt') #buttons would be placed from left to right first then bottom to top => the buttons would be stacked at the bottom from left to right first 
        self.floatt = FloatLayout() #free size 

        #variable for def gettinginformation()
        self.counter = 0 

        #title of the screen to be seen
        self.floatt.add_widget(Label(text='[color=000000][size=40][font=yorkwhiteletter]Last Screened Individual[/size][/font][/color]',size_hint= (0.5,0.2), halign='center',markup=True,pos_hint={'x':0.05,'y':0.8}))

        #information , left column. FIXED TEXT 
        '''x is moving left right, y is moving up and down
        0.0 for y is in the middle. to move down, use -ve 
        column of the table is fixed at x=0.2, or 0.2 left relative to floatlayout'''

        self.Lname=Label(text='[color=000000][size=40][font=Impact Label Reversed]Name\nBatch[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':0.1})
        self.Lid=Label(text='[color=000000][size=40][font=Impact Label Reversed]Card ID[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':0.0})
        self.Llocation = Label(text='[color=000000][size=40][font=Impact Label Reversed]Location[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':-0.1})
        self.Ltime=Label(text='[color=000000][size=40][font=Impact Label Reversed]Time\nDate[/font][/size][/color]',markup = True,pos_hint={'x':-0.2,'y':-0.2})

        self.floatt.add_widget(self.Lname)
        self.floatt.add_widget(self.Lid)
        self.floatt.add_widget(self.Ltime)
        self.floatt.add_widget(self.Llocation)
       
        #widgets to get information, depending on the card ID received, RHS column of information
        #currently made RHS columns contain a '-' to show no information is being displayed    
        self.namee = Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',halign='center',markup=True,pos_hint={'x':0.2,'y':0.1})
        self.Rid=Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',markup=True,pos_hint={'x':0.2,'y':0.0})
        self.Rlocation = Label(text='[color=000000][size=40][font=Impact Label Reversed]-[/size][/font][/color]',markup=True,pos_hint={'x':0.2,'y':-0.1})
        self.Rtime = Label(text='[color=000000][size=40][font=Impact Label Reversed]%s[/size][/font][/color]' %(time.strftime("%H:%M:%S\n%d/%m/%Y")),markup=True,pos_hint={'x':0.2,'y':-0.2})
        
        self.floatt.add_widget(self.namee)
        self.floatt.add_widget(self.Rid)
        self.floatt.add_widget(self.Rtime)
        self.floatt.add_widget(self.Rlocation)

        #fixed buttons at the bottom of the screen to navigate
        self.switchtomenu = Button(text='[size=50][font=yorkwhiteletter][color=000000]MENU[/font][/size][/color]',markup=True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToMenu)
        self.switchtoebot = Button(text='[size=50][font=yorkwhiteletter][color=000000]EBOTS[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToebots)
        self.switchtopersonal = Button(text='[size=50][font=yorkwhiteletter][color=000000]INDIVIDUAL[/font][/size][/color]', markup=True,size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.changeToPersonal)
        
        self.tryout.add_widget(self.switchtoebot)
        self.tryout.add_widget(self.switchtopersonal)
        self.tryout.add_widget(self.switchtomenu)

        # button to trigger gettinginformation 
        self.refresh=Button(text='[size=50][font=yorkwhiteletter][color=000000]REFRESH[/font][/size][/color]', markup = True, size_hint=(0.2,0.2),background_color=(1,1,1,0),on_press=self.gettinginformation)
        self.tryout.add_widget(self.refresh)

        #add layouts
        self.add_widget(self.tryout)
        self.add_widget(self.floatt)
Esempio n. 27
0
    def enter_state(self, context=None):
        print 'ShowingListsScreen/enter_state'

        if not 'Lists' in self.statechart.app.sm.screen_names:

            # Convenience references:
            self.app = self.statechart.app

            view = BoxLayout(orientation='vertical', spacing=10)

            toolbar = BoxLayout(size_hint=(1.0, None), height=50)

            label = Label(text='Lists', color=[.8, .8, .8, .8], bold=True)
            toolbar.add_widget(label)

            button = Button(text='Search')
            button.bind(on_press=self.go_to_search)
            toolbar.add_widget(button)

            button = Button(text='Data')
            button.bind(on_press=self.go_to_data)
            toolbar.add_widget(button)

            button = Button(text='Detail')
            button.bind(on_press=self.go_to_detail)
            toolbar.add_widget(button)

            view.add_widget(toolbar)

            lists_view = GridLayout(cols=3, size_hint=(1.0, 1.0))

            lists_view.add_widget(ListView(
                adapter=self.statechart.fruit_categories_dict_adapter,
                size_hint=(.2, 1.0)))

            lists_view.add_widget(ListView(
                adapter=self.statechart.fruits_dict_adapter,
                size_hint=(.2, 1.0)))

            selected_fruit = \
                    self.statechart.fruits_dict_adapter.selection[0].text
            self.detail_view = FruitDetailView(fruit_name=selected_fruit,
                                               size_hint=(.6, 1.0))

            lists_view.add_widget(self.detail_view)

            view.add_widget(lists_view)

            self.create_adapter_bindings()

            screen = Screen(name='Lists')
            screen.add_widget(view)
            self.app.sm.add_widget(screen)

        if self.app.sm.current != 'Lists':
            self.app.sm.current = 'Lists'
Esempio n. 28
0
    def build(self):
        self.py=ScreenManager()

        for i in range(4):
            p=Screen(name="pncr%d" % i)
            p.add_widget(Label(text="Pencere %d" % i))
            self.py.add_widget(p)
        self.py.current = 'pncr2'
        Clock.schedule_interval(self.pencereDegistir, 2)
        return self.py
Esempio n. 29
0
    def __init__(self, list_of_track_images, **kwargs):
        Screen.__init__(self, **kwargs)
        self._read_images(list_of_track_images)

        self.looking_direction_x = 0
        self.looking_direction_y = 0
        self.eye_range_x = 120
        self.eye_range_y = 85
        self.eye_offset = 3

        self._display_texture()
 def __init__(self):
     Screen.__init__(self, name="main")
     li = LoginProvider.getLoginInformation()
     if li.SIS.use:
         LoginProvider.isSISLoginInfoValid(li.SIS, self.gotSIS, self.errorSIS)
     else:
         self.errorSIS(None)
     if li.LMS.use:
         LoginProvider.isLMSLoginInfoValid(li.LMS, self.gotLMS, self.errorLMS)
     else:
         self.errorLMS(None)
 def __init__(self, root_app=None):
     Screen.__init__(self, name=self.screen_name)
     self.root_widget = Builder.load_file(os.path.join(FILE_DIR, self.view_kv_filepath))
     self.root_widget.link_to_app(root_app)
     self.add_widget(self.root_widget)
Esempio n. 32
0
    def build(self):
        self.screen_manager = ScreenManager()

        self.Login_page = LoginPage()
        screen = Screen(name="Login")
        screen.add_widget(self.Login_page)
        self.screen_manager.add_widget(screen)

        self.home_page = HomePage()
        screen = Screen(name="Home")
        screen.add_widget(self.home_page)
        self.screen_manager.add_widget(screen)

        self.patient_page = PatientPage()
        screen = Screen(name="Patient")
        screen.add_widget(self.patient_page)
        self.screen_manager.add_widget(screen)

        self.info_page = InfoPage()
        screen = Screen(name="Info")
        screen.add_widget(self.info_page)
        self.screen_manager.add_widget(screen)

        return self.screen_manager
Esempio n. 33
0
    def build(self):
        self.screenManager = ScreenManager()

        self.indexPage = index_main()
        indexScreen = Screen(name="Index")
        #indexScreen.add_widget(navbar())
        indexScreen.add_widget(self.indexPage)
        self.screenManager.add_widget(indexScreen)

        self.loginPage = LoginScreen()
        loginScreen = Screen(name="Login")
        loginScreen.add_widget(self.loginPage)
        self.screenManager.add_widget(loginScreen)

        self.signUpPage = SignUp()
        signUpScreen = Screen(name="SignUp")
        signUpScreen.add_widget(self.signUpPage)
        self.screenManager.add_widget(signUpScreen)

        self.dataPage = GetData()
        dataScreen = Screen(name="GetData")
        dataScreen.add_widget(self.dataPage)
        self.screenManager.add_widget(dataScreen)

        self.afterLoginPage = AfterLogin()
        afterLoginScreen = Screen(name="AfterLogin")
        afterLoginScreen.add_widget(self.afterLoginPage)
        self.screenManager.add_widget(afterLoginScreen)

        self.getUIDPage = ScanUID()
        getUIDScreen = Screen(name="GetUID")
        getUIDScreen.add_widget(self.getUIDPage)
        self.screenManager.add_widget(getUIDScreen)

        self.UpdateInfo = Update_info()
        UpdateInfoScreen = Screen(name="UpdateInfo")
        UpdateInfoScreen.add_widget(self.UpdateInfo)
        self.screenManager.add_widget(UpdateInfoScreen)

        self.VisualMenuPage = VisualMenu()
        VisualMenuScreen = Screen(name="VisualMenu")
        VisualMenuScreen.add_widget(self.VisualMenuPage)
        self.screenManager.add_widget(VisualMenuScreen)

        self.stepsVisualPage = StepsVisual()
        stepScreen = Screen(name="StepsVisual")
        stepScreen.add_widget(self.stepsVisualPage)
        self.screenManager.add_widget(stepScreen)

        self.sleepVisualPage = SleepVisual()
        sleepScreen = Screen(name="SleepVisual")
        sleepScreen.add_widget(self.sleepVisualPage)
        self.screenManager.add_widget(sleepScreen)

        self.heartRateVisualPage = HeartRateVisual()
        heartRateScreen = Screen(name="HeartRateVisual")
        heartRateScreen.add_widget(self.heartRateVisualPage)
        self.screenManager.add_widget(heartRateScreen)

        self.ppVisualPage = PPVisual()
        ppScreen = Screen(name="PPVisual")
        ppScreen.add_widget(self.ppVisualPage)
        self.screenManager.add_widget(ppScreen)

        return self.screenManager
Esempio n. 34
0
    def __init__(self, **kwargs):
        super(MainWid, self).__init__()
        self.APP_PATH = os.getcwd()
        self.DB_PATH = self.APP_PATH + '/my_database.db'
        self.StartWid = StartWid(self)
        self.DataBaseWid = DataBaseWid(self)
        self.InsertDataWid = BoxLayout()
        self.UpdateDataWid = BoxLayout()
        self.Popup = MessagePopup()

        wid = Screen(name='start')
        wid.add_widget(self.StartWid)
        self.add_widget(wid)
        wid = Screen(name='database')
        wid.add_widget(self.DataBaseWid)
        self.add_widget(wid)
        wid = Screen(name='insertdata')
        wid.add_widget(self.InsertDataWid)
        self.add_widget(wid)
        wid = Screen(name='updatedata')
        wid.add_widget(self.UpdateDataWid)
        self.add_widget(wid)

        self.goto_start()
Esempio n. 35
0
    def load_first_page(self, *args):
        if user := self.db.get_user():
            self.main_page = page = MainPage()
            self.nav_drawer.type = 'modal'

            self.playlist = self.db.get_playlist()
            self.favorites = self.db.get_favorites()
            if user['dark_mode']:
                self.theme_cls.theme_style = "Dark"
            else:
                self.theme_cls.theme_style = "Light"
            self.genres = user['genres']
            self.artists = user['artists']
            self.volume = user['volume']
            self.play_mode = user['play_mode']

            # load song
            song = self.playlist.current_track
            self.main_page.edit_ui_for_song(song)

            # adding screens
            main_screen = Screen(name='main_page')
            main_screen.add_widget(page)
            self.screen_manager.add_widget(main_screen)
            self.screen_manager.switch_to(main_screen)

            def set_pos(value):
                Logger.debug('SONG: pos %s', value)
                app.song.last_pos = value

            def set_state(value):
                Logger.debug('SONG: state %s', value)
                app.main_page.play_button.check_end()

            # Activity OSC Server
            try:
                activity_port = get_open_port()
            except Exception as e:
                Logger.error(("OSC: Couldn't get open port for activity."
                              "Setting 4999 instead. %s"), e)
                activity_port = 4999
            Logger.debug('ACTIVITY PORT: %s', activity_port)
            self.song = ServerSong(self,
                                   pos_callback=set_pos,
                                   state_callback=set_state,
                                   port=activity_port)

            # Start service
            try:
                service_port = get_open_port()
            except Exception as e:
                Logger.error(("OSC: Couldn't get open port for service."
                              "Setting 5000 instead. %s"), e)
                service_port = 5000
            Logger.debug('SERVICE PORT: %s', service_port)
            if platform == 'android':
                Logger.debug('ACTIVITY: Starting service.')
                args = [str(x) for x in self.song.getaddress()]
                args.append(str(service_port))
                argument = ",".join(args)
                start_service(argument)
                Logger.debug('ACTIVITY: Service started.')
            else:
                from threading import Thread
                from time import sleep
                from service import start_debug_server
                t = Thread(target=start_debug_server,
                           args=(
                               self.song.getaddress(),
                               service_port,
                           ))
                t.daemon = True
                t.start()
                sleep(1)  # allow debug server to finish setting up
            self.song.server_address = [
                self.song.getaddress()[0], service_port
            ]

            # Update UI
            self.play_button.load_song(song)
            self.song.last_pos = user['last_pos']
            slider = self.main_page.ids.playback_slider
            slider.seek(slider, None, value=self.song.last_pos)
            self.main_page.ids.track_current.text = str(
                timedelta(seconds=slider.value))[3:7]

            volume_slider = self.main_page.ids.volume_slider
            volume_slider.value = volume_slider.last_value = self.volume * 100

            Clock.schedule_once(lambda *args, song=song: self.complete_ui())
Esempio n. 36
0
class Application(ScreenManager):
    def __init__(self, **kwargs):
        super(Application, self).__init__(**kwargs)

        #Starting Screen
        self.db = BdManager("Tetris.db", "Players")
        self.reg_form = RegisterForm()
        self.start = Screen(name="Start")
        self.start.add_widget(self.reg_form)
        self.reg_form.submit.bind(on_press=self.to_login_screen)

        #Game Screen
        self.sound = SoundLoader.load("Main_theme.mp3")
        self.game = Screen(name="Game")
        self.add_widget(self.start)
        self.add_widget(self.game)

        self.create_game_screen()

    def create_game_screen(self):
        self.main = MainWindow()
        self.left_border = ScoreWindow()
        self.right_border = RightWindow()
        self.game_screen = GameWindow(size_hint_x=1.4,
                                      left=self.left_border,
                                      right=self.right_border)
        self.game_screen.proper_colors = proper_colors
        self.main.add_widget(self.left_border)
        self.main.add_widget(self.game_screen)
        self.main.add_widget(self.right_border)
        self.game.add_widget(self.main)
        self.game_screen.sound_btn.bind(on_press=self.play_music)
        self.game_screen.back_btn.bind(on_press=self.back)

    def play_music(self, instance):
        if instance.text == "Music off":
            instance.text = "Music on"
            self.sound.stop()
        else:
            instance.text = "Music off"
            self.sound.play()
            self.sound.loop = True

    def back(self, instance, *args):
        self.game.clear_widgets()
        self.switch_screen(instance)
        self.create_game_screen()
        if self.sound.state == "play":
            self.sound.stop()

    def switch_screen(self, instance):
        if self.current == "Start":
            self.current = "Game"
            #self.game_screen.define_next_figure()
            self.game_screen.create_figure()
        elif self.current == "Game":
            self.current = "Start"

    def to_login_screen(self, instance):
        self.firstname = self.reg_form.firstname_input.text.strip()
        self.lastname = self.reg_form.lastname_input.text.strip()
        if (self.lastname == "" or self.firstname == ""):
            pass
        else:
            self.img_source = self.reg_form.img.source
            self.popup = MyPopup(self.img_source, self)
            self.db.add_player(self.firstname, self.lastname)
            self.db.login(self.firstname, self.lastname)
            self.popup.lbl.text = f"Welcome {self.firstname} {self.lastname}"
            self.game_screen.img.source = self.img_source
            self.game_screen.firstname_label.text = f"{self.firstname}"
            self.game_screen.lastname_label.text = f"{self.lastname}"
            self.popup.open()

    def create_leaderboard(self):
        self.game_screen.pos_box.clear_widgets()
        self.game_screen.name_box.clear_widgets()
        self.game_screen.score_box.clear_widgets()
        for i in range(0, len(self.db.get_leaderboard_names()[:10])):
            self.game_screen.pos_box.add_widget(Label(text=f"{i+1}"))
        for name, lastname in self.db.get_leaderboard_names()[:10]:
            self.game_screen.name_box.add_widget(
                Label(text=f"{name} {lastname}"))
        for score in self.db.get_leaderboard_score()[:10]:
            self.game_screen.score_box.add_widget(Label(text=f"{score}"))
 def __init__(self, **kwargs):
     Screen.__init__(self, **kwargs)
Esempio n. 38
0
    def __init__(self, *args, **kwargs):
        super(Pages, self).__init__(**kwargs)

        self.transition = SwapTransition(duration=0.5)

        for page_list in config_data["page_list"]:
            self.page_screen = Screen(name=page_list["mode"])
            self.page = Page(
                page_name=page_list["mode"],
                rows=page_list["row"],
                cols=page_list["col"],
                text_list=page_list["text"],
                padding=5,
            )

            if page_list["mode"] == "days":
                self.page.preview.text = 'Click on the buttons with date!'
                self.page.layout.size_change(0, 1, 2)
                self.page.layout.size_change(1, 0, 1.5)
                self.page.layout.size_change(1, 2, 1.5)
                self.page.layout.size_change(-1, -1, 0.5)
                self.page.layout.buttons[1][0].text = self.page.layout.buttons[1][
                    2
                ].text = datetime.today().strftime(config_data["format"])

                def abc(*args):
                    today = datetime.strptime(args[0].text,config_data['format']).strftime("%d %m %Y").split()
                    date = Date(
                        button=args[0],
                        year=int(today[2]),
                        month=int(today[1]),
                        day=int(today[0]),
                    )
                    date.open()
                    self.parent.parent.options_open(args[0])

                def final(*args):
                    global config_data
                    temp = config_data["format"]
                    config_data["format"] = formats[args[0].values.index(args[0].value)]
                    self.page.layout.buttons[1][0].text = datetime.strptime(self.page.layout.buttons[1][0].text,temp).strftime(config_data['format'])
                    self.page.layout.buttons[1][2].text = datetime.strptime(self.page.layout.buttons[1][2].text,temp).strftime(config_data['format'])
                    
                    json.dump(config_data, open("config.json", "w"), indent=4)

                self.page.layout.buttons[1][0].bind(on_release=abc)
                self.page.layout.buttons[1][2].bind(on_release=abc)
                self.format_drop = Drop(
                    default = datetime.today().strftime(config_data['format']),
                    title="format",
                    size_hint=(0.7, 0.9),
                    values=list(datetime.today().strftime(x) for x in formats),
                )
                self.format_drop.bind(on_dismiss=final)
                self.format_drop.bind(on_dismiss=lambda button: self.parent.parent.options_close())
                self.page.layout.buttons[4][-1].bind(on_release=self.format_drop.open)
                self.page.layout.buttons[4][-1].bind(on_release= lambda button: self.parent.parent.options_open(button))

            elif page_list["mode"] == "convert":
                self.page.preview.text = 'Go for the units!'
                self.page.layout.buttons[0][1].bind(
                    on_release=self.page.layout.quantity_drop.open
                )
                self.page.layout.buttons[1][1].bind(
                    on_release=self.page.layout.from_drop.open
                )
                self.page.layout.buttons[1][3].bind(
                    on_release=self.page.layout.to_drop.open
                )

                self.page.layout.buttons[0][
                    1
                ].text = self.page.layout.quantity_drop.values[0]
                self.page.layout.buttons[1][1].text = self.page.layout.from_drop.values[
                    0
                ]
                self.page.layout.buttons[1][3].text = self.page.layout.to_drop.values[1]

                self.page.layout.buttons[0][1].bind(
                    on_release=lambda button: self.parent.parent.options_open(button)
                )
                self.page.layout.buttons[1][1].bind(
                    on_release=lambda button: self.parent.parent.options_open(button)
                )
                self.page.layout.buttons[1][3].bind(
                    on_release=lambda button: self.parent.parent.options_open(button)
                )

            elif page_list["mode"] == "standard":
                self.page.layout.size_change(-1, 0, 2)
            elif page_list["mode"] == "scientific":
                self.page.layout.size_change(-1, 0, 2)
                self.page.layout.inverse_change(self.page.layout.buttons[0][1])
                self.page.layout.buttons[0][2].text = 'RAD' if config_data['radian'] else 'DEG'

            self.page_screen.add_widget(self.page)
            self.add_widget(self.page_screen)
            self.pages_list.update({page_list["mode"]: self.page})
        
        if platform != "android":
            Clock.schedule_once(self.pages_list[config_data["page_list"][0]["mode"]].focus_entry,1)
Esempio n. 39
0
    def build(self):
        self.screen_manager = ScreenManager()

        self.entry_page = EntryPage()
        screen = Screen(name="Entry")
        screen.add_widget(self.entry_page)
        self.screen_manager.add_widget(screen)

        self.writing_rows = Writingrows()
        screen = Screen(name="Writing_rows")
        screen.add_widget(self.writing_rows)
        self.screen_manager.add_widget(screen)

        self.loading = Loading()
        screen = Screen(name="Loading")
        screen.add_widget(self.loading)
        self.screen_manager.add_widget(screen)

        self.results = Results()
        screen = Screen(name="Results")
        screen.add_widget(self.results)
        self.screen_manager.add_widget(screen)

        return self.screen_manager
Esempio n. 40
0
 def __init__(self, **kwargs):
     super(Current_Window, self).__init__(**kwargs)
     self.inside1 = Screen()
     self.inside1.cols = 2
     self.add_widget(
         Label(text='City',
               color=(0, 0, 0, 1),
               size_hint=(.45, .1),
               pos_hint={
                   'x': .05,
                   'y': .85
               }))
     self.City = TextInput(multiline=False,
                           size_hint=(.45, .1),
                           pos_hint={
                               'x': .5,
                               'y': .85
                           })
     self.add_widget(self.City)
     self.add_widget(
         Label(text='Wind(m/s)',
               color=(0, 0, 0, 1),
               size_hint=(.45, .1),
               pos_hint={
                   'x': .05,
                   'y': .4
               }))
     self.wind = TextInput(multiline=False,
                           size_hint=(.45, .1),
                           pos_hint={
                               'x': .5,
                               'y': .4
                           })
     self.add_widget(self.wind)
     self.add_widget(
         Label(text='Time',
               color=(0, 0, 0, 1),
               size_hint=(.45, .1),
               pos_hint={
                   'x': .05,
                   'y': .55
               }))
     self.time = TextInput(multiline=False,
                           size_hint=(.45, .1),
                           pos_hint={
                               'x': .5,
                               'y': .55
                           })
     self.add_widget(self.time)
     self.add_widget(
         Label(text='Power(kw/h)',
               color=(0, 0, 0, 1),
               size_hint=(.45, .1),
               pos_hint={
                   'x': .05,
                   'y': .25
               }))
     self.pawar = TextInput(multiline=False,
                            size_hint=(.45, .1),
                            pos_hint={
                                'x': .5,
                                'y': .25
                            })
     self.add_widget(self.pawar)
     self.btn5 = Button(text='calculate',
                        background_color=(0.9, 0.1, 0.2, 0.8),
                        size_hint=(.9, .1),
                        pos_hint={
                            'center_x': .5,
                            'y': .7
                        })
     self.add_widget(self.btn5)
     self.btn5.bind(on_press=self.calculate)
     self.inside1.btn8 = Button(text=' Goo back!',
                                background_color=(0.9, 0.1, 0.2, 0.8),
                                size_hint=(.43, .1),
                                pos_hint={
                                    'center_x': .75,
                                    'y': .08
                                })
     self.add_widget(self.inside1.btn8)
     self.inside1.btn8.bind(on_press=self.screen_transition)
     self.inside1.btn9 = Button(text='Clear!',
                                background_color=(0.9, 0.1, 0.2, 0.8),
                                size_hint=(.43, .1),
                                pos_hint={
                                    'center_x': .3,
                                    'y': .08
                                })
     self.add_widget(self.inside1.btn9)
     self.inside1.btn9.bind(on_press=self.screen_transition2)
Esempio n. 41
0
 def create_chat_page(self):
     self.chat_page = ChatPage()
     screen = Screen(name='Chat')
     screen.add_widget(self.chat_page)
     self.screen_manager.add_widget(screen)
Esempio n. 42
0
 def __init__(self, **kwargs):
     super(Prediction_Window, self).__init__(**kwargs)
     self.inside = Screen()
     self.inside.cols = 2
     self.add_widget(
         Label(text='City:',
               color=(0, 0, 0, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': 0.85
               }))
     self.City = TextInput(multiline=False,
                           size_hint=(.45, .08),
                           pos_hint={
                               'x': .5,
                               'y': 0.85
                           })
     self.add_widget(self.City)
     self.add_widget(
         Label(text='Which day in Future(eg-2/3):',
               color=(0, 0, 0, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': .75
               }))
     self.date = TextInput(multiline=False,
                           size_hint=(.45, .08),
                           pos_hint={
                               'x': .5,
                               'y': .75
                           })
     self.add_widget(self.date)
     self.add_widget(
         Label(text='Day:',
               color=(0, 0, 0, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': .65
               }))
     self.day = TextInput(multiline=False,
                          size_hint=(.45, .08),
                          pos_hint={
                              'x': .5,
                              'y': .65
                          })
     self.add_widget(self.day)
     self.add_widget(
         Label(text='Wind Mill power Forecast(kw/h):',
               color=(1, 1, 1, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': .27
               }))
     self.pawar = TextInput(multiline=False,
                            size_hint=(.45, .08),
                            pos_hint={
                                'x': .5,
                                'y': .27
                            })
     self.add_widget(self.pawar)
     self.add_widget(
         Label(text='Deficiet:',
               color=(1, 1, 1, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': .14
               }))
     self.Deficiet = TextInput(multiline=False,
                               size_hint=(.45, .08),
                               pos_hint={
                                   'x': .5,
                                   'y': .14
                               })
     self.add_widget(self.Deficiet)
     self.add_widget(
         Label(text='Alternative Source Available(eg- solar)',
               color=(0, 0, 0, 1),
               size_hint=(.45, .08),
               pos_hint={
                   'x': .05,
                   'y': .55
               }))
     self.solarX = TextInput(multiline=False,
                             size_hint=(.45, .08),
                             pos_hint={
                                 'x': .5,
                                 'y': .55
                             })
     self.add_widget(self.solarX)
     self.inside.btn7 = Button(text='Predict (Hold to see suggestion)',
                               background_color=(0.9, 0.1, 0.2, 0.9),
                               size_hint=(.43, .08),
                               pos_hint={
                                   'center_x': .75,
                                   'y': .40
                               })
     self.add_widget(self.inside.btn7)
     self.inside.btn7.bind(on_press=self.pressed)
     self.inside.btn15 = Button(
         text='Hold to see Ideal timing to use Wind Mill',
         background_color=(0.9, 0.1, 0.2, 0.9),
         size_hint=(.43, .08),
         pos_hint={
             'center_x': .3,
             'y': .40
         })
     self.add_widget(self.inside.btn15)
     self.inside.btn15.bind(on_press=self.pressed2)
     self.inside.btn8 = Button(text=' Goo back!',
                               background_color=(0.9, 0.1, 0.2, 0.9),
                               size_hint=(.43, .08),
                               pos_hint={
                                   'center_x': .75,
                                   'y': .03
                               })
     self.add_widget(self.inside.btn8)
     self.inside.btn8.bind(on_press=self.screen_tronsition)
     self.inside.btn9 = Button(text='Clear!',
                               background_color=(0.9, 0.1, 0.2, 0.9),
                               size_hint=(.43, .08),
                               pos_hint={
                                   'center_x': .3,
                                   'y': .03
                               })
     self.add_widget(self.inside.btn9)
     self.inside.btn9.bind(on_press=self.screen_tronsition2)
Esempio n. 43
0
    def enter_state(self, context=None):
        print 'ShowingDataScreen/enter_state'

        if not 'Data' in self.statechart.app.sm.screen_names:

            self.app = self.statechart.app

            view = BoxLayout(orientation='vertical', spacing=10)

            toolbar = BoxLayout(size_hint=(1.0, None), height=50)

            button = Button(text='Lists')
            button.bind(on_press=self.go_to_lists)
            toolbar.add_widget(button)

            button = Button(text='Search')
            button.bind(on_press=self.go_to_search)
            toolbar.add_widget(button)

            label = Label(text='Data', color=[.8, .8, .8, .8], bold=True)
            toolbar.add_widget(label)

            button = Button(text='Detail')
            button.bind(on_press=self.go_to_detail)
            toolbar.add_widget(button)

            view.add_widget(toolbar)

            props = [
                prop for prop in self.statechart.data['Apple']
                if prop != 'name'
            ]

            sorted_fruits = sorted(self.statechart.data.keys())
            data = {'Fruits': {'prop': 'Fruits', 'values': sorted_fruits}}
            for prop in sorted(props):
                data[prop] = \
                    dict({'prop': prop,
                          'values': [self.statechart.data[fruit][prop]
                                         for fruit in sorted_fruits]})
            props = sorted(props)
            props.insert(0, 'Fruits')

            args_converter = \
                lambda row_index, rec: \
                    {'size_hint': (None, None),
                     'height': 75,
                     'cls_dicts': [{'cls': ListItemLabel,
                                    'kwargs': {'halign': 'left',
                                               'size_hint': (None, None),
                                               'width': 200,
                                               'text_size': (200, None),
                                               'text': str(rec['prop'])}},
                                   {'cls': ListItemLabel,
                                    'kwargs': {'halign': 'right',
                                               'size_hint': (None, None),
                                               'text_size': (500, None),
                                               'width': 500,
                                               'text': str(rec['values'])}}]}

            dict_adapter = DictAdapter(sorted_keys=props,
                                       data=data,
                                       args_converter=args_converter,
                                       selection_mode='none',
                                       allow_empty_selection=True,
                                       cls=CompositeListItem)

            view.add_widget(ListView(adapter=dict_adapter))

            screen = Screen(name='Data')
            screen.add_widget(view)

            self.app.sm.add_widget(screen)

        if self.app.sm.current != 'Data':
            self.app.sm.current = 'Data'
Esempio n. 44
0
    def build(self):
        self.screen_manager = ScreenManager()

        self.main_window = MainWindow()
        screen = Screen(name='main')
        screen.add_widget(self.main_window)
        self.screen_manager.add_widget(screen)

        self.upd_window = UpdateWindow()
        screen = Screen(name='upd')
        screen.add_widget(self.upd_window)
        self.screen_manager.add_widget(screen)

        self.curr_window = CurrentWindow()
        screen = Screen(name='curr')
        screen.add_widget(self.curr_window)
        self.screen_manager.add_widget(screen)

        return self.screen_manager
Esempio n. 45
0
 def build(self):
     screen = Screen()
     self.helper_text = Builder.load_string(KV)
     screen.add_widget(self.helper_text)
     return screen
Esempio n. 46
0
 def __init__(self, *args, **kwargs):
     """constructor of the detail screen """
     Screen.__init__(self, *args, **kwargs)
     self.database = DataBase('base')
 def on_touch_down(self, touch):
     Screen.on_touch_down(self, touch)
 def __init__(self, **kwargs):
     BetterLogger.__init__(self)
     Screen.__init__(self, **kwargs)
Esempio n. 49
0
#screen manager 
sm = ScreenManager(transition=FadeTransition())


class MenuScreen(Screen):
    pass
class LibraryScreen(Screen):
    pass

boton_actual=" "
#encabezado organizador
encabezado=" "

#screens
screen=Screen(name='home')
screen2=Screen(name='libreria')

#propmt para recibir el nombre de materia

materia=TextInput(multiline=False,font_size=25,background_color=(0.125, 0.125, 0.125,1),background_normal= '',foreground_color=(1,1,1,1),border=(4, 4, 4, 4))

popup = Popup(title='Nombre de materia',content=materia,size_hint=(None, None), size=(200, 110))

#propmt para recibir el contenido del snippet

contenido=TextInput(multiline=False,font_size=15,background_color=(0.125, 0.125, 0.125,1),background_normal= '',foreground_color=(1,1,1,1),border=(4, 4, 4, 4))

popup_snippet=Popup(title='Nueva nota',content=contenido,size_hint=(None, None), size=(300, 400))

def crear_label(instance):
Esempio n. 50
0
 def new_color_screen(self):
     s = Screen(name=name)
     self.add_widget(s)
     self.current = name
Esempio n. 51
0
 def build(self):
     self.screen_manager = ScreenManager()
     self.main_page = MainPage()
     screen = Screen(name = "Main")
     screen.add_widget(self.main_page)
     self.screen_manager.add_widget(screen)
     
     
     
     self.purchase_page = PurchasePage()
     screen = Screen(name = "Purchase")
     screen.add_widget(self.purchase_page)
     self.screen_manager.add_widget(screen)
     
     print("R U THERE")
     
     self.payment_page = PaymentPage()
     screen = Screen(name = "Payment")
     screen.add_widget(self.payment_page)
     self.screen_manager.add_widget(screen)
     print('hi')
     
     
     return self.screen_manager
Esempio n. 52
0
    def build(self):
        self.screenManager = ScreenManager()

        self.loginScreen = LoginScreen()
        screen = Screen(name='Login')
        screen.add_widget(self.loginScreen)
        self.screenManager.add_widget(screen)

        self.loadingScreen = LoadingScreen()
        screen = Screen(name='Loading')
        screen.add_widget(self.loadingScreen)
        self.screenManager.add_widget(screen)

        self.appScreen = AppScreen()
        screen = Screen(name='App')
        screen.add_widget(self.appScreen)
        self.screenManager.add_widget(screen)
        return self.screenManager
Esempio n. 53
0
 def generate_screens(self):
     for group in group_cells:
         for c in items[group]:
             if type(c) == dict:
                 temp_screen = Screen(name=c.keys()[0])
                 temp_items = c[c.keys()[0]]
             else:
                 temp_screen = Screen(name=c)
                 temp_items = c
             main_container = BoxLayout(id='main_container',
                                        orientation='vertical',
                                        padding=[dp(10), 0, 0, 0],
                                        spacing=dp(20))
             if not type(temp_items) == str:
                 for i, value in enumerate(temp_items):
                     #print value
                     temp_box = BoxLayout(orientation='horizontal',
                                          size_hint_y=0.1)
                     temp_label = MDLabel(id='label' + str(i),
                                          font_style="Caption",
                                          halign="left",
                                          text=value,
                                          theme_text_color='Secondary'
                                          if self._app.theme_cls.theme_style
                                          == 'Light' else 'Primary')
                     temp_checkbox = MDResetCheckbox(pass_text=value,
                                                     size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                     temp_checkbox.bind(state=self.aux_populate)
                     self.bind(reset=temp_checkbox.set_active_false)
                     temp_box.add_widget(temp_label)
                     temp_box.add_widget(temp_checkbox)
                     main_container.add_widget(temp_box)
             else:
                 temp_box = BoxLayout(orientation='horizontal',
                                      size_hint_y=0.1)
                 if temp_items == 'Create other type':
                     temp_checkbox = MDResetCheckbox(size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                     temp_text_field = MDTextField(color_mode='accent')
                     temp_text_field.bind(
                         text=temp_checkbox.setter('pass_text'))
                     temp_box.add_widget(temp_text_field)
                 else:
                     temp_label = MDLabel(id='label1',
                                          font_style="Caption",
                                          halign="left",
                                          text=temp_items,
                                          theme_text_color='Secondary'
                                          if self._app.theme_cls.theme_style
                                          == 'Light' else 'Primary')
                     temp_box.add_widget(temp_label)
                     temp_checkbox = MDResetCheckbox(pass_text=temp_items,
                                                     size_hint=(None, None),
                                                     size=(dp(48), dp(48)),
                                                     pos_hint={
                                                         'center_x': 0.25,
                                                         'center_y': 0.5
                                                     })
                 temp_checkbox.bind(state=self.aux_populate)
                 self.bind(reset=temp_checkbox.set_active_false)
                 temp_box.add_widget(temp_checkbox)
                 main_container.add_widget(temp_box)
             main_container.add_widget(BoxLayout())
             temp_screen.add_widget(main_container)
             self.add_widget(temp_screen)
Esempio n. 54
0
            self.song.last_pos = user['last_pos']
            slider = self.main_page.ids.playback_slider
            slider.seek(slider, None, value=self.song.last_pos)
            self.main_page.ids.track_current.text = str(
                timedelta(seconds=slider.value))[3:7]

            volume_slider = self.main_page.ids.volume_slider
            volume_slider.value = volume_slider.last_value = self.volume * 100

            Clock.schedule_once(lambda *args, song=song: self.complete_ui())
        else:
            from kivy.lang import Builder
            import start_page
            self.nav_drawer.type = 'standard'
            Builder.load_file("kv/start_page.kv")
            start_screen = Screen(name='start_page')
            app.start_page = start_page.StartPage()
            start_screen.add_widget(app.start_page)
            self.screen_manager.add_widget(start_screen)

    def on_pause(self):
        self.on_stop()
        return True

    def on_stop(self):
        if app.song and self.db.get_user():
            song_pos = self.main_page.playback_slider.value
            self.db.update_last_pos(song_pos)
            self.db.update_volume(self.volume)
            # Clean up cached cover arts
            images = [
Esempio n. 55
0
    def __init__(self):
        self.sm = ScreenManager(transition = FadeTransition())
        
        # WIDGETS HOME
        self.label = Label()
        self.entry_host = TextInput()
        self.entry_host.text='192.168.0.4'

        self.entry_port = TextInput()
        self.entry_port.text = '5000'

        self.botao = Button()
        self.botao.text='Conectar'
        #=============================================

        # WIDGETS TERMINAL
        self.lbterminal = Label()
        self.entry_comando = TextInput()

        self.botao_ping = Button()
        self.botao_ping.text='Ping'
        
        self.botao_ins = Button()
        self.botao_ins.text='Cadastro'

        self.botao_env = Button()
        self.botao_env.text='Chrome'

        self.botao_desc = Button()
        self.botao_desc.text='Desconectar'
        #============================================

        # WIDGETS CADASTRO

        self.lbcadastro = Label()
        
        self.entry_nome = TextInput(hint_text = 'Nome')
        self.entry_sexo = TextInput(hint_text = 'Sexo')
        self.entry_telefone = TextInput(hint_text = 'Telefone')
        self.entry_email = TextInput(hint_text = 'E-mail')

        self.bt_send = Button()
        self.bt_send.text='Enviar'
        #============================================


        """Configuração da janela principal (Home) """
        
        # Tela inicial
        self.screen_home = Screen()
        self.screen_home.name='home'
        
        # BoxLayout da Tela principal
        box_label = BoxLayout()
        box_entry = BoxLayout(orientation = 'vertical')
        box_botao = BoxLayout()
        box_pai = BoxLayout(orientation = 'vertical')

        # BoxLayout da Label
        box_label.add_widget(self.label)

        # BoxLayout das entry
        box_entry.add_widget(self.entry_host)
        box_entry.add_widget(self.entry_port)

        # BoxLayout dos botões
        box_botao.add_widget(self.botao)
        
        # BoxLayout -pai que unificar todos os outros Box Layout
        box_pai.add_widget(box_label)
        box_pai.add_widget(box_entry)
        box_pai.add_widget(box_botao)

        # Inserir Box_pai na Janela principal
        self.screen_home.add_widget(box_pai)
        

        """Configuração da janela pós-conexão (Terminal) """
        
        # Tela a ser exibida
        self.screen_terminal = Screen()
        self.screen_terminal.name='terminal'

        # BoxLayout do terminal
        box_lbscreen = BoxLayout()
        box_interminal = BoxLayout()
        box_btterminal = BoxLayout()
        box_paiterminal = BoxLayout(orientation = 'vertical')

        # BoxLayout da label terminal
        box_lbscreen.add_widget(self.lbterminal)

        # BoxLayout da entry terminal
        box_interminal.add_widget(self.entry_comando)

        # BoxLayout dos botões terminal
        box_btterminal.add_widget(self.botao_ins)
        box_btterminal.add_widget(self.botao_env)
        box_btterminal.add_widget(self.botao_ping)
        box_btterminal.add_widget(self.botao_desc)

        # BoxLayout -pai que unificar todos os outros Box Layout
        box_paiterminal.add_widget(box_lbscreen)
        box_paiterminal.add_widget(box_interminal)
        box_paiterminal.add_widget(box_btterminal)

        # Inserir box_pai terminal na janela
        self.screen_terminal.add_widget(box_paiterminal)


        """ Tela de cadastro """
        
        # Tela a ser exibida
        self.screen_cadastro = Screen()
        self.screen_cadastro.name='cadastro'

        # BoxLayout do cadastro
        box_lbcadastro = BoxLayout()
        box_incadastro = BoxLayout(orientation = 'vertical')
        box_btcadastro = BoxLayout()
        box_paicadastro = BoxLayout(orientation = 'vertical')

        # BoxLayout label cadastro
        box_lbcadastro.add_widget(self.lbcadastro)

        # BoxLayout entry cadastro
        box_incadastro.add_widget(self.entry_nome)
        box_incadastro.add_widget(self.entry_sexo)
        box_incadastro.add_widget(self.entry_telefone)
        box_incadastro.add_widget(self.entry_email)

        # BoxLayout botão cadastro
        box_btcadastro.add_widget(self.bt_send)

        # Box_pai cadastro
        box_paicadastro.add_widget(box_lbcadastro)
        box_paicadastro.add_widget(box_incadastro)
        box_paicadastro.add_widget(box_btcadastro)
        
        # Inserir box_pai na janela
        self.screen_cadastro.add_widget(box_paicadastro)
        

        #-------------------------------------------------------

        self.sm.add_widget(self.screen_home)
        self.sm.add_widget(self.screen_terminal)
        self.sm.add_widget(self.screen_cadastro)

        




        






        
Esempio n. 56
0
    def build(self):
        self.from_move = None
        self.to_move = None
        self.chessboard = ChessBoard()
        self.analysis_board = ChessBoard()
        self.squares = []
        self.use_engine = False
        self.last_touch_down_move = None
        self.last_touch_up_move = None

        parent = BoxLayout(size_hint=(1, 1))
        grid = GridLayout(cols=8, rows=8, spacing=0, size_hint=(1, 1))

        for i, name in enumerate(SQUARES):
            bt = Image(allow_stretch=True)
            bt.sq = i
            bt.name = name
            # bt.border = [0,0,0,0]
            if i in light_squares:
                bt.sq_color = "l"
                bt.background_down = "img/empty-l.png"

            #                bt.background_color=[1,1,1,1]
            else:
                bt.sq_color = "d"
                bt.background_down = "img/empty-d.png"

            #                bt.background_color=[0,0,0,0]
            #                print i
            # bt.bind(on_press=self.callback)
            bt.bind(on_touch_down=self.touch_down_move)
            bt.bind(on_touch_up=self.touch_up_move)
            # bt.bind(on_touch_up=self.touch_move)

            grid.add_widget(bt)
            self.squares.append(bt)

        b = BoxLayout(size_hint=(0.15, 0.15))
        ## Spacers
        #        b.add_widget(Button(spacing=1))
        #        b.add_widget(Button(spacing=1))
        #        b.add_widget(Button(spacing=1))

        # Move control buttons
        #        back_bt = Button(markup=True)
        #       # back_bt.background_normal="img/empty-l.png"
        #        back_bt.text="[color=ff3333]Back[/color]"
        #        back_bt.bind(on_press=self.back)
        #        b.add_widget(back_bt)
        #
        save_bt = Button(markup=True)
        #fwd_bt.background_normal="img/empty-d.png"
        save_bt.text = "[color=3333ff]Save[/color]"
        # save_bt.text="Save"

        save_bt.bind(on_press=self.save)
        b.add_widget(save_bt)

        #        b.add_widget(Button(spacing=10))
        #        b.add_widget(Button(spacing=10))
        #        b.add_widget(Button(spacing=10))

        #        grid.add_widget(b)

        #        board_box.add_widget(grid)
        #        board_box.add_widget(b)

        #        fen_input = TextInput(text="FEN", focus=True, multiline=False)
        #        def on_fen_input(instance):
        #            self.chessboard.setFEN(instance.text)
        #            self.refresh_board()
        ##            print 'The widget', instance.text
        #
        #        fen_input.bind(on_text_validate=on_fen_input)
        ##        self._keyboard.bind(on_key_down=self._on_keyboard_down)
        #
        #
        #        b.add_widget(fen_input)

        settings_bt = Button(markup=True, text='Setup')
        settings_bt.bind(on_press=self.go_to_settings)
        b.add_widget(settings_bt)

        #        self.root.current='settings'

        parent.add_widget(grid)

        info_grid = GridLayout(cols=1,
                               rows=4,
                               spacing=1,
                               size_hint=(0.3, 1),
                               orientation='vertical')
        info_grid.add_widget(b)

        self.game_score = ScrollableLabel('New Game',
                                          ref_callback=self.go_to_move)

        info_grid.add_widget(self.game_score)

        self.engine_score = ScrollableLabel(
            '[ref=engine_toggle]Analysis[/ref]',
            ref_callback=self.add_eng_moves)
        info_grid.add_widget(self.engine_score)

        info_grid.add_widget(Button(text="Text"))

        parent.add_widget(info_grid)
        self.refresh_board()

        platform = kivy.utils.platform()
        self.uci_engine = None
        if self.is_desktop():
            self._keyboard = Window.request_keyboard(self._keyboard_closed,
                                                     self)
            self._keyboard.bind(on_key_down=self._on_keyboard_down)

            self.start_engine_thread()
        sm = ScreenManager(transition=SlideTransition())
        board_screen = Screen(name='main')
        board_screen.add_widget(parent)
        sm.add_widget(board_screen)

        settings_screen = SettingsScreen(name='settings')
        settings_screen.add_widget(self.generate_settings())

        sm.add_widget(settings_screen)

        return sm
Esempio n. 57
0
 def build(self):
     screen = Screen()
     self.theme_cls.primary_palette = "Teal"
     run = Builder.load_string(kivy)
     screen.add_widget(run)
     return screen
Esempio n. 58
0
    def build(self):

        if not os.path.isdir(PROFILE_PICTURES_LOCATION):
            os.makedirs(PROFILE_PICTURES_LOCATION)

        state = State()
        sm = ScreenManager()

        create_screen = Screen(name="create_db_screen")
        create_screen.add_widget(
            CreateDBWidget(state=state, db_filename=DB_FILENAME))
        sm.add_widget(create_screen)

        login_screen = Screen(name="login_screen")
        login_screen.add_widget(
            LoginWidget(state=state, sm=sm, db_filename=DB_FILENAME))
        sm.add_widget(login_screen)

        roster_screen = Screen(name="roster_screen")
        roster_widget = RosterWidget(state=state, sm=sm)
        roster_screen.add_widget(roster_widget)
        roster_screen.bind(on_pre_enter=roster_widget.on_pre_enter)
        sm.add_widget(roster_screen)

        contact_add_screen = Screen(name="contact_add_screen")
        contact_add_screen.add_widget(ContactAddWidget(state=state, sm=sm))
        sm.add_widget(contact_add_screen)

        contact_edit_screen = Screen(name="contact_edit_screen")
        contact_edit_screen.add_widget(
            ContactEditWidget(state=state, sm=sm, screen=contact_edit_screen))
        sm.add_widget(contact_edit_screen)

        if os.path.isdir(DB_FILENAME):
            sm.current = "login_screen"
        else:
            sm.current = "create_db_screen"

        # # XXX: this is only for debug
        # state.set_backend(
        #     Backend(db_location=DB_FILENAME, key=state.hash_pin("1234"))
        # )
        # state.set_edited_contact("Alice")
        # sm.current = "contact_edit_screen"

        return sm
Esempio n. 59
0
 def build(self):
     screen = Screen()
     help_str = Builder.load_string(KV)
     screen.add_widget(help_str)
     return screen
Esempio n. 60
0
    def __init__(self, **kw):
        super().__init__(**kw)
        self.build()
        self.sm = ScreenManager()

        self.boxlayout = BoxLayout(orientation='vertical')

        self.main_screen = MDScreen()
        self.main_screen.size_hint = 1, .4

        year = int(datetime.now().strftime("%Y"))

        self.current_year = f'{year}/{year - 579}'
        self.yearchooser = YearChooser()
        self.yearchooser.size_hint_y = 0.1

        self.widget = Widget()
        self.widget.size_hint_y = 0.02

        self.topBar = TopBar()
        self.topBar.size_hint_y = 0.1

        current_month = datetime.now().strftime("%B")

        self.months = {
            'January': 1,
            'February': 2,
            'March': 3,
            'April': 4,
            'May': 5,
            'June': 6,
            'July': 7,
            'August': 8,
            'September': 9,
            'October': 10,
            'November': 11,
            'December': 12
        }

        day = datetime.now().strftime("%d")
        days = ['M', 'T', 'W', 'T', 'F', 'S', 'S']

        self.events = EventContent().create(int(year),
                                            self.months[current_month],
                                            int(day))
        self.events.size_hint = 1, .6

        for month in self.months:
            screen = Screen(name=month)

            grid = MDGridLayout(cols=7)
            grid.id = month

            spacer_grid = MDGridLayout(cols=7)
            spacer_grid.size_hint_y = .2
            spacer_grid.size_hint_x = 1

            screen.add_widget(grid)

            for day in days:
                grid.add_widget(DayLabel(text=day))

            daysinmonth = calendar.monthrange(year, self.months[month])[1] + 1

            for i in range(1, daysinmonth):
                if i == 1:
                    day = self.getDay("2021", month, str(i))
                    daynum = getattr(calendar, day.upper())

                    for n in range(daynum):
                        grid.add_widget(Spacer())

                label = SelectableLabel(text=str(i))
                if month == current_month and label.text == str(
                        datetime.now().strftime('%#d')):
                    label.selected = True

                grid.add_widget(label)

            self.sm.add_widget(screen)

        self.main_screen.add_widget(self.sm)

        self.sm.current = str(current_month)

        self.boxlayout.add_widget(self.yearchooser)
        self.boxlayout.add_widget(self.topBar)
        self.boxlayout.add_widget(self.main_screen)
        self.boxlayout.add_widget(self.widget)
        self.boxlayout.add_widget(self.events)

        self.add_widget(self.boxlayout)