gui base template created

This commit is contained in:
DESKTOP-JVKHS7I\Adam 2020-04-17 04:44:33 +05:30
parent d6c013c1a2
commit 5b90524d91
3 changed files with 89 additions and 13 deletions

View File

@ -3,14 +3,12 @@
Usage:
fishy.py -h | --help
fishy.py -v | --version
fishy.py [--debug] [--ip=<ipv4>] [--hook-threshold=<int>] [--check-frequency=<hz>] [--collect-r] [--borderless]
fishy.py [--debug] [--ip=<ipv4>] [--collect-r] [--borderless]
Options:
-h, --help Show this screen.
-v, --version Show version.
--ip=<ipv4> Local Ip Address of the android phone.
--hook-threshold=<int> Threshold amount for classifier after which label changes [default: 1].
--check-frequency=<hz> Sleep after loop in s [default: 1].
--debug Start program in debug controls.
--borderless Use if the game is in fullscreen or borderless window
"""
@ -22,14 +20,7 @@ import cv2
from docopt import docopt
from pynput.keyboard import Listener
from fishy.systems.controls import Control
from fishy.systems.fishing_event import HookEvent, StickEvent, LookEvent, IdleEvent
from fishy.systems.fishing_mode import FishingMode
from fishy.systems.globals import G
from fishy.systems.log import Log
from fishy.systems.pixel_loc import PixelLoc
import fishy.systems.fishy_network as net
from fishy.systems.window import Window
from fishy.systems import *
"""
Start reading from `init.py`
@ -85,13 +76,12 @@ def startFishing():
"""
Control.current = 1 if G.arguments["--debug"] else 0
FishingMode.Threshold = int(G.arguments["--hook-threshold"])
use_net = G.arguments["--ip"] is not None
if use_net:
net.initialize(G.arguments["--ip"])
sleepFor = (1 / float(G.arguments["--check-frequency"]))
sleepFor = 1
# initializes fishing modes and their callbacks
FishingMode("hook", 0, HookEvent())

View File

@ -0,0 +1,8 @@
from fishy.systems.controls import Control
from fishy.systems.fishing_event import HookEvent, StickEvent, LookEvent, IdleEvent
from fishy.systems.fishing_mode import FishingMode
from fishy.systems.globals import G
from fishy.systems.log import Log
from fishy.systems.pixel_loc import PixelLoc
import fishy.systems.fishy_network as net
from fishy.systems.window import Window

78
fishy/systems/gui.py Normal file
View File

@ -0,0 +1,78 @@
from tkinter import *
def start():
writeToLog(console, "yo")
def writeToLog(log, msg):
numlines = log.index('end - 1 line').split('.')[0]
log['state'] = 'normal'
if int(numlines) >= 50: # delete old lines
log.delete(1.0, 2.0)
if log.index('end-1c') != '1.0': # new line for each log
log.insert('end', '\n')
log.insert('end', msg)
log.see("end") # scroll to bottom
log['state'] = 'disabled'
root = Tk()
root.title("Fiishybot for Elder Scrolls Online")
root.geometry('600x600')
# region menu
menubar = Menu(root)
filemenu = Menu(menubar, tearoff=0)
filemenu.add_command(label="Create Shortcut", command=start)
menubar.add_cascade(label="File", menu=filemenu)
debug_menu = Menu(menubar, tearoff=0)
debug_menu.add_command(label="Check PixelVal", command=start)
debug_menu.add_command(label="LogDump", command=start)
menubar.add_cascade(label="Debug", menu=debug_menu)
root.config(menu=menubar)
# endregion
# region console
console = Text(root, state='disabled', wrap='none')
console.pack(fill=BOTH, expand=True, pady=(15, 15), padx=(5, 5))
console.mark_set("sentinel", INSERT)
console.config(state=DISABLED)
controls_frame = Frame(root)
# endregion
# region controls
left_frame = Frame(controls_frame)
Label(left_frame, text="IP").grid(row=0, column=0)
ip = Entry(left_frame)
ip.grid(row=0, column=1)
Label(left_frame, text="Fullscreen: ").grid(row=1, column=0, pady=(5, 5))
borderless = Checkbutton(left_frame)
borderless.grid(row=1, column=1)
left_frame.grid(row=0, column=0)
right_frame = Frame(controls_frame)
Label(right_frame, text="Action Key:").grid(row=0, column=0)
action_key_entry = Entry(right_frame)
action_key_entry.grid(row=0, column=1)
action_key_entry.insert(0, "e")
Label(right_frame, text="Press start").grid(row=1, columnspan=2, pady=(5, 5))
right_frame.grid(row=0, column=1, padx=(50, 0))
controls_frame.pack()
Button(root, text="START", width=25, command=start).pack(pady=(15, 15))
# endregion
# root.update()
# root.minsize(root.winfo_width(), root.winfo_height())
root.mainloop()