Esempio n. 1
0
 def __init__(self):
     sg.theme('GreenTan')
     self.data = uData.gui_setting()
     self.layout = self.create_layout()
     self.window = sg.Window(f'kirafan-bot  v{uData.setting["version"]}', self.layout, finalize=True)
     self.update_tab_selected(self.find_tab_by_name(self.data['questList']['quest_selector']).id)
     self.update_tabs_bind()
     self.update_adb_bind()
     self.battle_job = self.visit_room_job = self.cork_shop_job = Job()
     self.hotkey = Hotkey('s', mode='gui', window=self.window)
     if self.data['adb']['use']:
         self.hotkey.remove_all_hotkey()
     logger.propagate = False
     logger.addHandler(GUI_Handler(self.window, '_log_box_', self.blocked))
     self._open_re = re.compile(r'^_(\d+|button|update|tab_group|adb|timer|log_level|sleep)_.*$')
Esempio n. 2
0
 def __init__(self):
     hCheck = win32gui.FindWindow(None, 'kcon')
     if hCheck > 0:
         echo('Program has been running')
     else:
         self.root = Tk()
         self.root.title('kcon')
         hwnd = self.root.winfo_id()
         self.box = self.TaskList(self.root)
         self.edit = self.EditLine(self.root, self.box)
         self.root.bind_all('<Control-Key-a>', self.onCtrlA)
         self.root.bind_all("<Key>", self.onPress)
         self.root.bind_all('<Return>', self.onReturn)
         self.hotkey = Hotkey(self.root)
         self.root.mainloop()
Esempio n. 3
0
def main():
    all_bots = ", ".join(get_all_bots())
    parser = argparse.ArgumentParser()
    parser.add_argument("-b", "--bot", help=f"Available bots: {all_bots}")
    args = parser.parse_args()

    h = Hotkey()
    if args.bot:
        try:
            bot_module = __import__(f"bots.{args.bot}",
                                    fromlist=('PressKey', ))
            bot = bot_module.PressKey()
            h.load_bot(bot)
        except ModuleNotFoundError as e:
            logger.error(e)

    h.run()
Esempio n. 4
0
def main():
    if uData.setting['mode'].lower() == 'gui':
        kirafanbot_GUI().open()
    elif uData.setting['mode'].lower() == 'hotkey':
        try:
            hotkey = Hotkey('rslmptcoxkvei')
            logger.info("kirafan-bot: hotkey setting finish...")
            logger.info(f'kirafan-bot: region = {list(kirafan.region)}')
            logger.info(
                f'kirafan-bot: adb use = {uData.setting["adb"]["use"]}')
            logger.info(
                f'kirafan-bot: quest setting = \x1b[41m{kirafan.quest_name}\x1b[0m'
            )
            check_basic_information()
            logger.info('please press \'f3\' button to exit...')
            hotkey.wait('f3')
            hotkey.safe_exit()
        except KeyboardInterrupt:
            hotkey.safe_exit()
Esempio n. 5
0
def test_hotkey():
    hotkey = Hotkey('rslmptcoxkvei')
    assert hotkey.safe_exit() is None
    assert hotkey._Hotkey__user_command('1') is None
    assert hotkey._Hotkey__user_command('r') is None
    assert hotkey._Hotkey__user_command('s') is None
    assert hotkey._Hotkey__user_command('l') is None
    # assert hotkey._Hotkey__user_command('m') is None
    assert hotkey._Hotkey__user_command('t') is None
    assert hotkey._Hotkey__user_command('c') is None
    assert hotkey._Hotkey__user_command('o') is None
    # assert hotkey._Hotkey__user_command('x') is None
    assert hotkey._Hotkey__user_command('k') is None
    assert hotkey._Hotkey__user_command('k') is None  # switch back
    assert hotkey._Hotkey__user_command('v') is None
    assert hotkey._Hotkey__user_command('s') is None
    assert hotkey._Hotkey__user_command('e') is None
    assert hotkey._Hotkey__user_command('s') is None
    assert hotkey._Hotkey__user_command('i') is None
    assert os.path.exists('screenshot0.png') is True
    assert hotkey.remove_all_hotkey() is None
Esempio n. 6
0
 def __init__(self):
     QThread.__init__(self)
     from hotkey import Hotkey
     self.hotkey = Hotkey(self.handle_hotkey)