-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.py
More file actions
60 lines (55 loc) · 2.08 KB
/
Copy pathmain.py
File metadata and controls
60 lines (55 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import dearpygui.dearpygui as dpg
import pywinstyles
import logging
from core.config import Config, get_platform
from core.input import KeySequence
from core.farmer import Farmer
from core.update import Update
from core.network import Network
from core.process import Process
from core.logger import setup_logger
from gui.gui import MainGUI
from gui.interface import Interface
# stop farmer, release all keys, show window if hidden
def on_exit():
config.settings.save_all()
hwnd = process.get_hwnd()
if farmer.running:
logger.info('stopping farmer')
farmer.stop()
if hwnd:
keyseq.release_all()
process.show()
if __name__ == '__main__' and get_platform():
setup_logger()
logger = logging.getLogger('prawl')
config = Config()
interface = Interface()
process = Process(config)
update = Update(config)
network = Network(config, process)
keyseq = KeySequence(process, interface)
farmer = Farmer(process, interface, keyseq, network)
gui = MainGUI(config, process, interface, keyseq, farmer, update)
dpg.create_viewport(
title=f'prawl v{config.version}',
min_width=292, width=292,
min_height=170, height=170,
small_icon=str(config.icon),
large_icon=str(config.icon)
)
dpg.set_viewport_always_top(bool(config.settings.get('other', 'always_on_top')))
dpg.set_exit_callback(on_exit)
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.set_primary_window('main', True)
pywinstyles.change_header_color(None, config.theme.to_hex(config.theme.get_col('colors', 'bg_primary')))
pywinstyles.change_border_color(None, config.theme.to_hex(config.theme.get_col('colors', 'bg_primary')))
pywinstyles.change_title_color(None, config.theme.to_hex(config.theme.get_col('colors', 'text_secondary_disabled')))
if config.settings.get('other', 'auto_launch'):
logger.info('auto_launch enabled, launching brawlhalla')
gui.main_callbacks.launch_button()
logger.info('starup completed')
dpg.start_dearpygui()
dpg.destroy_context()
logger.info('prawl closed')