python类bind()的实例源码

main.py 文件源码 项目:RKSV 作者: ztp-at 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(VerifyReceiptWidget, self).__init__(**kwargs)
        if platform == 'android':
            pm = PythonActivity.mActivity.getPackageManager()
            if not pm.hasSystemFeature(PM.FEATURE_CAMERA):
                return

            def addCamButton(instance):
                self.loadLayout.add_widget(Button(size_hint=(None, 1),
                        text='C', on_press=self.takePicture))
            Clock.schedule_once(addCamButton, 0)
            activity.bind(on_activity_result=self.takePictureCb)
main.py 文件源码 项目:RKSV 作者: ztp-at 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def viewReceipt(self, btn):
        try:
            recs, cert, cert_list = self.dep[btn.group_id]
            jws = recs[btn.receipt_id]
            rec, prefix = receipt.Receipt.fromJWSString(jws)

            self._receipt_view = getModalView()
            content = ViewReceiptWidget(rec, prefix, self._verified,
                    self.aesInput.text, cancel=self._receipt_view.dismiss)
            self._receipt_view.add_widget(content)
            self._receipt_view.bind(on_open=content.firstDisplay)
            self._receipt_view.open()
        except receipt.ReceiptException as e:
            displayError(e)
rktool.py 文件源码 项目:RKSV 作者: ztp-at 项目源码 文件源码 阅读 31 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(VerifyReceiptWidget, self).__init__(**kwargs)
        if platform == 'android':
            pm = PythonActivity.mActivity.getPackageManager()
            if not pm.hasSystemFeature(PM.FEATURE_CAMERA):
                return

            def addCamButton(instance):
                self.loadLayout.add_widget(Button(size_hint=(None, 1),
                        text='C', on_press=self.takePicture))
            Clock.schedule_once(addCamButton, 0)
            activity.bind(on_activity_result=self.takePictureCb)
rktool.py 文件源码 项目:RKSV 作者: ztp-at 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def viewReceipt(self, btn):
        try:
            recs, cert, cert_list = self.dep[btn.group_id]
            jws = recs[btn.receipt_id]
            rec, prefix = receipt.Receipt.fromJWSString(jws)

            self._receipt_view = getModalView()
            content = ViewReceiptWidget(rec, prefix, self._verified,
                    self.aesInput.text, cancel=self._receipt_view.dismiss)
            self._receipt_view.add_widget(content)
            self._receipt_view.bind(on_open=content.firstDisplay)
            self._receipt_view.open()
        except receipt.ReceiptException as e:
            displayError(e)
program.py 文件源码 项目:Easy 作者: HeaTTheatR 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, **kvargs):
        super(Program, self).__init__(**kvargs)
        Window.bind(on_keyboard=self.events_program)

        # ??? ??????? ????????? ? programclass.
        self.Screen = Screen
        self.Clock = Clock
        self.CustomMenuItem = CustomMenuItem
        self.KDialog = KDialog
        self.BDialog = BDialog
        self.Manifest = Manifest
        self.SwapTransition = SwapTransition
        self.choice = choice
        self.get_color_from_hex = get_color_from_hex
        self.get_hex_from_color = get_hex_from_color
        self.core = core
        self.name_program = core.string_lang_title
        self.navigation_drawer = NavigationDrawer(side_panel_width=230)
        self.current_open_tab = core.string_lang_tabbed_menu_shops
        self.shop = False  # ????????? ???????
        self.open_dialog = False  # ??????? ?????????? ????

        self.effects_transition = (SlideTransition, SwapTransition)
        # ?????? ?????????.
        self.shops = core.dict_shops.keys()
        # ?????? ???????.
        self.locations = [
            location.split('.')[0].lower() for location in os.listdir(
                '{}/Data/Images/locations'.format(core.prog_path))]
screen_blanker.py 文件源码 项目:SuperOcto 作者: mcecchi 项目源码 文件源码 阅读 18 收藏 0 点赞 0 评论 0
def start(self, bl_interval):
      """Start blanking system. Screen will blank after bl_interval seconds."""
      if bl_interval > 0:
        self.bl_interval = bl_interval
        self._schedule()
        Window.bind(on_touch_down=self._on_window_touch_down)
main.py 文件源码 项目:kivy_rpg 作者: spinningD20 项目源码 文件源码 阅读 15 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(GameApp, self).__init__(**kwargs)
        print('app init')
        Window.bind(on_resize=self.resize)

    #
    # def on_start(self):
    #     self.profile = cProfile.Profile()
    #     self.profile.enable()
    #
    #
    # def on_stop(self):
    #     self.profile.disable()
    #     self.profile.dump_stats('myapp.profile')
main.py 文件源码 项目:kivy_rpg 作者: spinningD20 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def new_game(self, choice='clyde'):
        print('new game')
        # get numbers of last save files to find an appropriate save file id to provide copying
        # make this beast a lot shorter sometime soon.  Probably just iterate over files with choice in them, inc
        # all_tmx_files_to_db() # update seed file for any changes from tmx files before copying it to use
        save_number = 0
        for rootdir, dir, files in os.walk(SAVE_PATH):
            current_number = len(fnmatch.filter(files, choice + '*.save'))
            if current_number > save_number:
                save_number = current_number
        save_number += 1
        filename = choice + '-' + str(save_number)
        while os.path.isfile(SAVE_PATH + filename + '.save'):
            filename += '0'
        filename = SAVE_PATH + filename + '.save'
        # copy seed db file with name of filename to make a new save file
        copyfile(os.path.join(runpath, 'seed.db'), filename)
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # set player flags like main_character, player_party, etc
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        if not player_character_flag:
            player_character_flag = GameFlag()
            player_character_flag.name = 'player_character'
        player_character_flag.value = choice
        # MAYBE TO-DO : find clyde map object and set its coords and map_id to values for clyde choice?
        # FOR NOW, commit changes
        self.db.add(player_character_flag)
        self.db.commit()
        print('save file created...loading', filename)
        self.load_game(filename)
main.py 文件源码 项目:kivy_rpg 作者: spinningD20 项目源码 文件源码 阅读 17 收藏 0 点赞 0 评论 0
def load_game(self, filename=os.path.join(runpath, 'seed.db')):
        print('hitting load game')
        # set the db here, get current map player object was last at, and load that map
        engine = create_engine('sqlite:///' + filename)
        Session = sessionmaker(bind=engine)  # configure session object
        self.db = Session()
        # until the other characters are in the db, trying to load a game with anyone but clyde will crash
        player_character_flag = self.db.query(GameFlag).filter(GameFlag.name == 'player_character').first()
        self.player_object = self.db.query(MapObject).filter(MapObject.name == player_character_flag.value).first()
        tilemap = self.db.query(TileMap).filter(TileMap.id == self.player_object.map_id).first()
        self.manager.current = 'Game'
        self.load_map(tilemap.file_name)
main.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(Jarvis, self).__init__(**kwargs)
        Win.bind(on_keyboard=self.onBackBtn)
main.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def build(self):
        self.title = "GoshenApp"
        #from kivy.core.window import Window
        #Window.size = (450, 600)
        #self.service = None
        self.start_service()
        osc.init()
        oscid = osc.listen(port=3002)
        osc.bind(oscid, self.display_message, '/message')
        Clock.schedule_interval(lambda *x: osc.readQueue(oscid), 0)
        self.theme_cls.theme_style = 'Dark'
        self.theme_cls.primary_palette = 'Indigo'
        self.nav_drawer = Drawer()
        return GbeeRoot()
date_picker.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, parent):
        super(DaySelector, self).__init__()
        self.parent_class = parent
        self.parent_class.add_widget(self, index=7)
        self.selected_widget = None
        Window.bind(on_resize=self.move_resize)
theming.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
tabs.py 文件源码 项目:kivy_gosh 作者: mcroni 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
def __init__(self, panel, height, tab):
        self.panel = panel
        self.height = height
        self.tab = tab
        super(MDBottomNavigationHeader, self).__init__()
        self._current_color = self.theme_cls.disabled_hint_text_color
        self._label = self.ids._label
        self._label_font_size = sp(12)
        self.theme_cls.bind(primary_color=self._update_theme_color,
                            disabled_hint_text_color=self._update_theme_style)
        self.active = False
theming.py 文件源码 项目:KivyMD 作者: cruor99 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(ThemeManager, self).__init__(**kwargs)
        self.rec_shadow = Atlas('{}rec_shadow.atlas'.format(images_path))
        self.rec_st_shadow = Atlas('{}rec_st_shadow.atlas'.format(images_path))
        self.quad_shadow = Atlas('{}quad_shadow.atlas'.format(images_path))
        self.round_shadow = Atlas('{}round_shadow.atlas'.format(images_path))
        Clock.schedule_once(lambda x: self.on_theme_style(0, self.theme_style))
        self._determine_device_orientation(None, Window.size)
        Window.bind(size=self._determine_device_orientation)
visual_debugger_app.py 文件源码 项目:SerpentAI 作者: SerpentAI 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        super().__init__()

        self.images = dict()

        self.root = FloatLayout(size=(Window.width, Window.height))
        self.grid = GridLayout(cols=8)

        self.add_widget(self.root)
        self.root.add_widget(self.grid)

        for i, bucket in enumerate(config["visual_debugger"]["available_buckets"]):
            layout = BoxLayout(orientation="vertical")

            image = VisualDebuggerImage(
                allow_stretch=True
            )

            image.bind(texture=image.update_texture_filters)

            self.images[bucket] = image

            layout.add_widget(image)

            label = Label(
                text=bucket,
                color=(1, 1, 1, 1),
                size_hint=(1, 0.1)
            )

            layout.add_widget(label)

            self.grid.add_widget(layout)

        Window.bind(on_resize=self.on_window_resize)
        Window.clearcolor = (0.136, 0.191, 0.25, 1)
program.py 文件源码 项目:DemoKivyContacts 作者: HeaTTheatR 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self, **kvargs):
        super(Program, self).__init__(**kvargs)
        Window.bind(on_keyboard=self.events_program)

        self.window = Window
        self.dialog_load_contact = None
        self.open_exit_dialog = None
        self.scren_add_groups = None  # kivy.lang.builder.AddContactAddGroups
        self.data = data
        self.current_tab = 'contacts'
        self.load_all_kv_files()
resize.py 文件源码 项目:garden.resizable_behavior 作者: kivy-garden 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(ResizableBehavior, self).__init__(**kwargs)
        Window.bind(mouse_pos=self.on_mouse_move)
        Clock.schedule_once(_modalview.put_on_top, 0)
        self.oldpos, self.oldsize = [], []
__init__.py 文件源码 项目:mmplayer 作者: Bakterija 项目源码 文件源码 阅读 16 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        super(HoverBehavior, self).__init__(**kwargs)
        self.bind(parent=self._on_parent_update_hover)
focus.py 文件源码 项目:mmplayer 作者: Bakterija 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, **kwargs):
        self.register_event_type('on_focus_textinput')
        super(FocusBehavior, self).__init__(**kwargs)
        self.fbind('focus', self.remove_other_focused)
        self.fbind('is_focusable', self.update_is_focusable)
        if not self.is_subfocus:
            self.bind(parent=on_parent)
            if self.grab_focus and self.is_focusable:
                self.focus_widget(self)


问题


面经


文章

微信
公众号

扫码关注公众号