示例#1
0
 def __init__(self, **kw):
     super().__init__(**kw)
     self.app = MDApp.get_running_app()
     self.sub_title = "Welcome to Home Screen"
示例#2
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.bind(on_dismiss=Clock.schedule_once(
         lambda _dt: MDApp.get_running_app().gui.update_state(), 1))
示例#3
0
 def callback2(self, *args):
     MDApp.get_running_app().stop()
示例#4
0
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     MDApp.get_running_app().bind(language=self.build_values)
 def __init__(self, **kw):
     super().__init__(**kw)
     self.app = MDApp.get_running_app()
示例#6
0
 def on_pre_open(self):
     """Cancel the global focus listener from taking focus as popups don't show up in `walk()`"""
     try:
         Clock.unschedule(MDApp.get_running_app().listener.asking)
     except AttributeError:  # Mostly for Android
         pass
示例#7
0
 def do_exit(self):
     app = MDApp.get_running_app()
     app.exit_routine(pool=self.pool)
示例#8
0
 def app(self):
     return MDApp.get_running_app()
示例#9
0
 def enter_info_screen(self, _):
     MDApp.get_running_app().row = self.info
     self.manager.current = "info_screen"
示例#10
0
文件: main.py 项目: Fox520/NamJobHunt
 def on_release(self):
     MDApp.get_running_app().manage_screens("job_list_screen", "add")
     MDApp.get_running_app().change_screen("job_list_screen")
示例#11
0
 def toggle_cls(self):
     """Different toggle class for mobile and desktop"""
     return MDApp.get_running_app().toggle_cls
示例#12
0
文件: main.py 项目: Fox520/NamJobHunt
 def on_enter(self):
     MDApp.get_running_app().category_list.append({"height": dp(150)})
     MDApp.get_running_app().category_list.append({"height": dp(150)})
     MDApp.get_running_app().category_list.append({"height": dp(150)})
     MDApp.get_running_app().category_list.append({"height": dp(150)})
     MDApp.get_running_app().category_list.append({"height": dp(150)})
示例#13
0
文件: main.py 项目: Fox520/NamJobHunt
 def on_enter(self):
     for _ in range(10):
         MDApp.get_running_app().job_list.append({"height": dp(150)})
示例#14
0
 def set_game_node(self, node):
     katrain = MDApp.get_running_app().gui
     katrain.game.set_current_node(node)
     katrain.update_state()
示例#15
0
 def do_exit():
     MDApp.get_running_app().exit_routine()
示例#16
0
def _fetch_db_into_dict():
    """Fetch entire database table into dictionary"""
    app = MDApp.get_running_app()
    table = app.cursor.execute('SELECT * FROM PCD').fetchall()
    description = [col[0] for col in app.cursor.description]
    return [dict(zip(description, item)) for item in table]
示例#17
0
 def __init__(self, **kwargs):
     io = MDApp.get_running_app().io_manager
     root, names = io.locate_pool(return_names=True)
     filepaths = [os.path.join(root, n) for n in names]
     super().__init__(**kwargs)
     self.display_options(filepaths)
示例#18
0
 def __init__(self):
     user_data_dir = getattr(MDApp.get_running_app(), 'user_data_dir')
     self.PATH = os.path.join(os.path.dirname(user_data_dir), 'Focus', 'database')
     if not os.path.isdir(self.PATH):
         os.makedirs(self.PATH)
     self.PATH = os.path.join(self.PATH, 'user_db.sqlite')
示例#19
0
 def __init__(self, item_pool, **kwargs):
     super().__init__(**kwargs)
     self.item_pool = item_pool
     self.app = MDApp.get_running_app()
示例#20
0
 def low_spec(self):
     if self._low_spec is None:
         self._low_spec = MDApp.get_running_app().low_spec
     return self._low_spec
示例#21
0
    def accesstesttext(self, dt):
        app = MDApp.get_running_app()


        #Report start
        print('------ Report ------')

        #Access app level class variable
        print(app.test_text)           

        #Access root level class variable (which in this case is the screen manager)
        print(app.root.test_text)      # Start from the top app level
        print(self.parent.test_text)   # Or start from OneScreen level

        #Access mainscreen level class variable
        print(self.test_text)          # (which is just itself)
        print(app.root.get_screen('mainscreen').test_text)  # Or start from the app level

        #Access mainscreen level instance variable
        print(self.test_text_instance)
        print(app.root.get_screen('mainscreen').test_text_instance)

        #Access children of the mainscreen
        print(self.ids.boxlayout.test_text)    #One level down
        print(app.root.get_screen('mainscreen').ids.boxlayout.test_text)  # Or start from the app level
        print(self.ids.searchbar.test_text)    #Two level down
        print(self.ids.searchbar.ids.label_title.font_name)               # Sub level within the MDToolbar
        print(self.ids.iconbutton.test_text)   #Three level down
        print(self.ids.md_list.test_text)      #Two Level down - MDList

        #Access twoscreen level class variable
        print(self.parent.get_screen('twoscreen').test_text)  # Start from current level
        print(app.root.get_screen('twoscreen').test_text)     # Or start from the app level
        print(self.parent.get_screen('twoscreen').ids.twoscreen_label.test_text)  # One level down in twoscreen

        #Access down the tree using multiple .ids?
        #print(self.ids.md_list.ids.swipedefault.test_text)   # This won't work, since swipe1 will not be in md_list
        print(self.ids.swipedefault.test_text)                # Instead this will work
        #print(self.ids.swipe1.test_text)                     # This won't work, since swipe1 is dynamically added, so it won't be in self.ids
        
        #Access the ids in different levels
        print('IDs:')
        print(self.ids)                     # Note that it has id of all levels under Onescreen, including the swipe_default under md_list
        print(self.ids.toolbar.ids)         # Note that it does not have the iconbutton under toolbar
        print(self.ids.scrollview.ids)      # Note that it has nothing!

        #Access objects down the widget tree using self.children
        #A lot of information here!
        print('Widget Tree:')
        for child in self.children:
            print("First Level:", child)              # One level down - BoxLayout
            print("     Second Level:", child.children)    # Two level down
            for sub_child in child.children:
                # Grab the children of md_list
                if hasattr(sub_child, 'name'):        # Check if it has name attribute
                    if sub_child.name == 'scrollview':
                        #print(sub_child.ids)
                        sub2_child = sub_child.children[0]       #Get the particular children, in this case MD List
                        print(f'     Picked: {sub2_child}')
                        print("          Third Level:", sub2_child.children)
                        for sub3_child in sub2_child.children:
                            if hasattr(sub3_child, 'id'):
                                print(f'          {sub3_child.id}')   # Note that only the dynamically added ones has .id attribute, not the kivy one
                            print(f'          {sub3_child.name}')     # But all of them has name attribute
                            print(f'          {sub3_child.test_text}')               # And the class variable can be accessed
                            print(f'          {sub3_child.text}')

        #Doing similar things using walk()
        print('Walk:')
        for widget in self.walk():
            if hasattr(widget, 'id'):
                print("{} -> {}".format(widget, widget.name))

        #After doing the weakref thing, we can access the swipe items directly
        print(self.ids.swipe1.test_text)
        print(self.ids.swipe2.test_text)
        print(self.ids.swipe3.test_text)
示例#22
0
 def request_pool_load(self):
     io = MDApp.get_running_app().io_manager
     pool = io.load_pool()
     if pool:
         self.populate_from_pool(pool)
示例#23
0
 def update_global_player_info(self):
     if self.parent and self.parent.update_global:
         katrain = MDApp.get_running_app().gui
         if katrain.game and katrain.game.current_node:
             katrain.update_player(self.player, **self.player_type_dump)
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.app = MDApp.get_running_app()
     self.fecha_hoy = int(time.strftime('%Y%m%d'))
     self.fecha_hoy_texto = (time.strftime('%d/%m/%Y'))
     Clock.schedule_interval(self.actualizar_scroll, 2)
示例#25
0
 def __init__(self, **kwargs):
     self._shadow = MDApp.get_running_app().theme_cls.round_shadow
     self.draw_shadow = WeakMethod(self.__draw_shadow__)
     self._fake_elevation = True
     self._update_shadow(self, self.elevation)
     super().__init__(**kwargs)
示例#26
0
 def __init__(self, **kw):
     super().__init__(**kw)
     self.app = MDApp.get_running_app()
     Clock.schedule_once(self.after_init, 1)
 def __init__(self, **kwargs):
     super().__init__(**kwargs)
     self.app = MDApp.get_running_app()
     self.player_info = None
     self.piecharts = [0, 0, 0]
 def volveramenu(self):
     app = MDApp.get_running_app()
     app.root.current = 'menu'
示例#29
0
 def settings(self, prev_page):
     sm = MDApp.get_running_app().root.ids.screen_manager
     sm.transition.direction = 'left'
     sm.current = 'settings_screen'
     sm.screens[5].ids.prev_page = prev_page
示例#30
0
 def close_error(self):
     """closes error dialog"""
     app = MDApp.get_running_app()
     app.volume_view_model.close_error()