-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmain.py
700 lines (652 loc) · 33.2 KB
/
main.py
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
import logging
import win32gui
from dearpygui import core, simple
from dearpygui.core import mvGuiCol_Text, mvGuiCol_WindowBg, mvGuiCol_Button, mvGuiCol_Border, \
mvGuiCol_ButtonActive, delete_item, mvGuiCol_ButtonHovered, mvGuiCol_BorderShadow, \
mvGuiStyleVar_WindowRounding
from dearpygui.demo import mvGuiStyleVar_FramePadding
import eloOverlay
from config import DBNAME, WEB_FONT
from database import db_create, sqlite3db
from faceit import faceit_api
from functions import config_functions, functions, webHandler
from functions import openFileDialog
from guiHandling.animationHandler import animation_config_color, animation_config_web, animation_config_help
from guiHandling.colorHandling import reset_colors, save_colors, test_colors
from guiHandling.errorHandler import set_error, set_warning, delete_error
from guiHandling.refreshHandler import save_refresh_time, refresh_symbol
from guiHandling.sizeHandler import save_scale, reset_scale
from guiHandling.webHandler import save_font, save_web
from guiHandling.winLossHandler import win_los
from web import overlayWeb, webFunctions
"""
Global Values
iChanges : set if a change was made in a configuration
"""
iChanges = 0
""" -------------------------------------------------------------------------------------------------------------------
GET START DATA
---------------------------------------------------------------------------------------------------------------------"""
def startup():
"""
Get all data from the Database. If no Database entry exists, set everything on default.
"""
logging.info("Get startup values")
acEloGoal = config_functions.get_elo_goal_from_db()
iRv = config_functions.check_if_dbfile_exists()
FACEIT_List = []
MATCH_List = []
nameFACEIT = ""
if iRv > 0:
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_REFRESH
""")
if iRv <= 0:
sqlite3db.TExecSql(DBNAME,
"""
INSERT INTO CFG_REFRESH
VALUES (?)
""", 60
)
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_REFRESH_SIGN
""")
if iRv <= 0:
sqlite3db.TExecSql(DBNAME,
"""
INSERT INTO CFG_REFRESH_SIGN
VALUES (?)
""", "True"
)
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_WEB
""")
if iRv <= 0:
ins = 'False', 'False'
sqlite3db.TExecSql(DBNAME,
"""
INSERT INTO CFG_WEB
VALUES (?,?)
""", ins
)
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_WIN_LOSS
""")
if iRv <= 0:
Initial_Load = (False, False)
sqlite3db.TExecSql(DBNAME,
"""
INSERT INTO CFG_WIN_LOSS
VALUES (?, ?)
""", Initial_Load
)
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_STATS_FACEIT
""")
if iRv > 0:
list_faceit = sqlite3db.TExecSqlReadMany(DBNAME, """
SELECT * FROM CFG_STATS_FACEIT
"""
)
list_matches = sqlite3db.TExecSqlReadMany(DBNAME, """
SELECT * FROM CFG_STATS_MATCH
"""
)
nameFACEIT = config_functions.get_faceit_name_from_db()
for i in list_faceit[0]:
if i == str(0):
FACEIT_List.append(False)
else:
FACEIT_List.append(True)
for i in list_matches[0]:
if i == str(0):
MATCH_List.append(False)
else:
MATCH_List.append(True)
return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal
else:
for x in range(0, 6):
FACEIT_List.append(True)
for x in range(0, 7):
MATCH_List.append(True)
return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal
else:
for x in range(0, 6):
FACEIT_List.append(True)
for x in range(0, 7):
MATCH_List.append(True)
return FACEIT_List, MATCH_List, nameFACEIT, acEloGoal
""" -------------------------------------------------------------------------------------------------------------------
CHECKBOX HANDLING
---------------------------------------------------------------------------------------------------------------------"""
def changes_detected():
"""
Check if changes are detected and change the Color of Apply Configuration red.
Set the global var iChanges to 1 in case someone tries to start without saving
"""
global iChanges
core.set_item_color("Apply Configuration", mvGuiCol_Text, (255, 0, 0, 255))
iChanges = 1
set_false = 0
cnt = 0
acList = (core.get_value("Score##match"),
core.get_value("Result (W/L)##match"),
core.get_value("Map##match"))
for x in acList:
if x is False:
cnt = cnt + 1
if cnt != 2:
for x in acList:
if x is False:
core.set_value("Result (W/L)##match", False)
core.set_value("Map##match", False)
core.set_value("Score##match", False)
set_false = 1
break
if set_false == 0:
core.set_value("Result (W/L)##match", True)
core.set_value("Map##match", True)
core.set_value("Score##match", True)
def disable_all(sender):
"""
Checkbox Disable all;
get all checkbox Items and set them to False
Call the changes_detected function to set iChanges to 1
"""
items = core.get_all_items()
for i in items:
if "stats" in i and "stats" in sender:
core.set_value(i, False)
if "match" in i and "match" in sender:
core.set_value(i, False)
changes_detected()
def enable_all(sender):
"""
Checkbox Enable all;
get all checkbox Items and set them to True ( beside the Disable / Enable all )
Call the changes_detected function to set iChanges to 1
"""
items = core.get_all_items()
for i in items:
if "stats" in i and "stats" in sender:
core.set_value(i, True)
if i == "Disable All##stats":
core.set_value(i, False)
if i == "Enable All##stats":
core.set_value(i, False)
if "match" in i and "match" in sender:
core.set_value(i, True)
if i == "Disable All##match":
core.set_value(i, False)
if i == "Enable All##match":
core.set_value(i, False)
changes_detected()
""" -------------------------------------------------------------------------------------------------------------------
APPLY CONFIGURATION
---------------------------------------------------------------------------------------------------------------------"""
def get_values_to_safe_faceit():
"""
get all values to save and return them in different lists.
"""
acName = core.get_value("##FaceitName")
acElo = core.get_value("Current Elo##stats")
acRank = core.get_value("Faceit Rank##stats")
acEloToday = core.get_value("Elo Gained today##stats")
acStreak = core.get_value("Win Streak##stats")
acTotMatches = core.get_value("Total Matches##stats")
acMatchesWon = core.get_value("Matches Won##stats")
acScore = core.get_value("Score##match")
acResult = core.get_value("Result (W/L)##match")
acMap = core.get_value("Map##match")
acKd = core.get_value("K/D##match")
acEloDiff = core.get_value("Elo Diff##match")
acKills = core.get_value("Kills##match")
acDeath = core.get_value("Death##match")
FACEIT_List = (acElo, acRank, acEloToday,
acStreak, acTotMatches, acMatchesWon)
MATCH_List = (acMap, acResult, acScore, acKd, acEloDiff,
acKills, acDeath)
return FACEIT_List, MATCH_List, acName
def save_data():
"""
Save all configuration into the database. if a database already exists update the current one.
get and set the FACEIT name. if the Name isn't correct set error
"""
global iChanges
iRv = config_functions.check_if_config_entry_exists("""
SELECT COUNT(*) FROM CFG_STATS_FACEIT
""")
FACEIT_List, MATCH_List, acName = get_values_to_safe_faceit()
name = config_functions.get_faceit_name_from_db()
acEloGoal = core.get_value("##EloGoal")
if not acName:
set_error("Faceit Name must be set!")
return
if name:
name = functions.listToStringWithoutBracketsAndAT(name[0])
if name != acName and acName:
sqlite3db.TExecSql(DBNAME, """
DELETE FROM CFG_FACEIT_NAME""")
sqlite3db.TExecSql(DBNAME, """
INSERT INTO CFG_FACEIT_NAME
VALUES (? )""", acName)
if iRv == 1:
sqlite3db.TExecSql(DBNAME, """
UPDATE CFG_STATS_FACEIT SET CurrentElo = ?,
Rank = ?,
EloToday = ?,
WinStreak = ?,
TotalMatches = ?,
MatchesWon = ?
""", FACEIT_List)
sqlite3db.TExecSql(DBNAME, """
UPDATE CFG_STATS_MATCH SET Score = ?,
Result = ?,
Map = ?,
KD = ?,
EloDiff = ?,
Kills = ?,
Death = ?
""", MATCH_List)
sqlite3db.TExecSql(DBNAME, """
UPDATE CFG_FACEIT_NAME SET Name = ?
""", acName)
else:
sqlite3db.TExecSql(DBNAME, """
INSERT INTO CFG_STATS_FACEIT
VALUES (?, ?, ?, ?, ?, ?)""", FACEIT_List)
sqlite3db.TExecSql(DBNAME, """
INSERT INTO CFG_STATS_MATCH
VALUES (?, ?, ?, ?, ?, ?, ?)""", MATCH_List)
if acName:
sqlite3db.TExecSql(DBNAME, """
INSERT INTO CFG_FACEIT_NAME
VALUES (? )""", acName)
if acEloGoal:
iRv = sqlite3db.TExecSqlReadCount(DBNAME, """
SELECT COUNT(*) FROM CFG_FACEIT_TARGET_ELO
""")
if iRv > 0:
sqlite3db.TExecSql(DBNAME, """
UPDATE CFG_FACEIT_TARGET_ELO
SET TARGET = ?
""", int(acEloGoal))
else:
sqlite3db.TExecSql(DBNAME, """
INSERT INTO CFG_FACEIT_TARGET_ELO
VALUES (? )""", acEloGoal)
else:
sqlite3db.TExecSql(DBNAME, """
DELETE FROM CFG_FACEIT_TARGET_ELO""")
delete_error()
COL_List = config_functions.get_color()
core.set_item_color("Apply Configuration", mvGuiCol_Text,
(COL_List[1][1], COL_List[1][2], COL_List[1][3], 255))
iRv = faceit_api.get_api_user(acName)
if iRv is None:
set_error("Error: Wrong FACEIT Name")
iChanges = 0
""" -------------------------------------------------------------------------------------------------------------------
OVERLAY START
---------------------------------------------------------------------------------------------------------------------"""
def open_overlay():
"""
Open the Elo Overlay
But first check if the FACEIT name is set
If the FACEIT name isn't correct return
If changes be made and not saved, return with a warning
"""
global iChanges
faceit_name = config_functions.get_faceit_name_from_db()
if faceit_name:
if core.does_item_exist("Error##ErrorNoFACEITName"):
return
if iChanges == 1:
set_warning("Configuration not saved, press Apply Configuration")
else:
web = webFunctions.get_web()
if web[0]:
overlayWeb.open_browser_and_fill_with_content()
if web[1]:
overlayWeb.open_browser_and_fill_with_content()
open_app_overlay(faceit_name)
if not web[0] and not web[1]:
open_app_overlay(faceit_name)
else:
set_error("No FACEIT Name configured")
def open_app_overlay(faceit_name):
height = config_functions.check_for_layout()
hwnd = win32gui.GetForegroundWindow()
win32gui.MoveWindow(hwnd, 0, 0, 208, height[0] + 39, True)
simple.hide_item("##Overlay")
simple.hide_item("##Config")
win32gui.SetWindowText(hwnd, f"{faceit_name} Elo")
eloOverlay.show_main()
""" -------------------------------------------------------------------------------------------------------------------
BUILD WINDOW WITH DPG
---------------------------------------------------------------------------------------------------------------------"""
def start_build_dpg():
with simple.window("FACEIT Elo Overlay", on_close=lambda: delete_item("FACEIT Elo Overlay"),
no_title_bar=True, no_resize=True):
"""
Set window configurations
"""
simple.set_window_pos("FACEIT Elo Overlay", 0, 0)
core.set_main_window_title("FACEIT Elo Overlay")
core.set_main_window_size(492, 830)
core.set_style_frame_rounding(6.00)
core.add_additional_font("resources/OpenSans-Bold.ttf", size=14.5)
"""
Initial loads
"""
db_create.create_database(DBNAME)
COLOR_List = config_functions.get_color()
"""
Set some Background and Font Colors
also the frame rounding and the window size
"""
core.set_theme_item(mvGuiCol_Text, COLOR_List[1][0], COLOR_List[1][1], COLOR_List[1][2], COLOR_List[1][3])
core.set_theme_item(mvGuiCol_WindowBg, COLOR_List[3][0], COLOR_List[3][1], COLOR_List[3][2], COLOR_List[3][3])
core.set_theme_item(mvGuiCol_Border, COLOR_List[4][0], COLOR_List[4][1], COLOR_List[4][2], COLOR_List[4][3])
core.set_style_frame_border_size(1.00)
core.set_theme_item(mvGuiCol_Button, COLOR_List[0][0], COLOR_List[0][1], COLOR_List[0][2], COLOR_List[0][3])
core.set_theme_item(mvGuiCol_ButtonHovered,
COLOR_List[0][0], COLOR_List[0][1], COLOR_List[0][2], COLOR_List[0][3])
core.set_theme_item(mvGuiCol_ButtonActive, COLOR_List[2][0], COLOR_List[2][1], COLOR_List[2][2],
COLOR_List[2][3])
core.set_theme_item(mvGuiCol_BorderShadow, COLOR_List[0][0], COLOR_List[0][1], COLOR_List[0][2] - 50,
COLOR_List[0][3])
with simple.window('##Overlay', no_collapse=True, no_resize=True, no_move=True, no_close=True, x_pos=30, y_pos=0,
width=445,
height=790, no_title_bar=True):
"""
Set a Header
"""
bool_list_faceit, bool_list_match, name, acEloGoal = startup()
core.add_button("FACEIT Overlay Menu")
core.set_item_style_var("FACEIT Overlay Menu", mvGuiStyleVar_FramePadding, [5 * 27, 5 * 3])
core.add_spacing(count=5)
"""
Build up the FACEIT Stats configuration
"""
with simple.group("##GroupStats"):
core.add_button("Default Configurations##STATS")
core.set_item_style_var("Default Configurations##STATS", mvGuiStyleVar_FramePadding, [5 * 20, 5 * 3])
core.add_spacing(count=5)
core.add_text("##TextFaceitName", default_value="FACEIT Name:", color=(255, 255, 0, -1))
core.add_input_text("##FaceitName", hint="FACEIT Name Case sensitive", default_value=name,
callback=changes_detected)
core.add_spacing(count=2)
core.add_text("##TextEloGoal", default_value="FACEIT Elo goal:")
core.add_input_text("##EloGoal", hint="Set your Elo goal, empty = disabled", default_value=str(acEloGoal),
callback=changes_detected)
core.add_spacing(count=5)
"""
Faceit Stats header
"""
core.add_button("FACEIT Stats")
core.set_item_style_var("FACEIT Stats", mvGuiStyleVar_FramePadding, [5 * 26, 5 * 3])
core.add_spacing(count=2)
"""
Checkbox group
"""
core.add_checkbox("Disable All##stats", default_value=False,
callback=lambda sender, data: disable_all(sender))
core.add_same_line()
core.add_checkbox("Enable All##stats", default_value=False,
callback=lambda sender, data: enable_all(sender))
core.add_spacing(count=3)
"""
Checkbox group
"""
core.add_checkbox("Current Elo##stats", default_value=bool_list_faceit[0],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("Faceit Rank##stats", default_value=bool_list_faceit[1],
callback=changes_detected)
"""
Checkbox group
"""
core.add_checkbox("Elo Gained today##stats", default_value=bool_list_faceit[2],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("Win Streak##stats", default_value=bool_list_faceit[3],
callback=changes_detected)
"""
Checkbox group
"""
core.add_checkbox("Total Matches##stats", default_value=bool_list_faceit[4],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("Matches Won##stats", default_value=bool_list_faceit[5],
callback=changes_detected)
core.add_spacing(count=2)
win_loss = config_functions.get_win_loss()
print(win_loss)
if win_loss[0][0] is None:
win_loss = [(0, 0)]
core.add_text("##TextWinLoss", default_value="Win/Loss Stats:")
core.add_checkbox("Day##WinLoss", default_value=int(win_loss[0][0]),
callback=lambda sender, data: win_los(sender))
core.add_same_line()
core.add_checkbox("Week##WinLoss", default_value=int(win_loss[0][1]),
callback=lambda sender, data: win_los(sender))
core.add_spacing(count=5)
"""
Last Match header
"""
core.add_button("Last Match")
core.set_item_style_var("Last Match", mvGuiStyleVar_FramePadding, [5 * 26.5, 5 * 3])
core.add_spacing(count=2)
"""
Checkbox group
"""
core.add_checkbox("Disable All##match", default_value=False,
callback=lambda sender, data: disable_all(sender))
core.add_same_line()
core.add_checkbox("Enable All##match", default_value=False,
callback=lambda sender, data: enable_all(sender))
core.add_spacing(count=3)
"""
Checkbox group
"""
core.add_checkbox("Score##match", default_value=bool_list_match[0],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("Result (W/L)##match", default_value=bool_list_match[1],
callback=changes_detected)
"""
Checkbox group
"""
core.add_checkbox("Map##match", default_value=bool_list_match[2],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("K/D##match", default_value=bool_list_match[3],
callback=changes_detected)
"""
Checkbox group
"""
core.add_checkbox("Elo Diff##match", default_value=bool_list_match[4],
callback=changes_detected)
core.add_same_line(xoffset=250)
core.add_checkbox("Kills##match", default_value=bool_list_match[5],
callback=changes_detected)
"""
Checkbox group
"""
core.add_checkbox("Death##match", default_value=bool_list_match[6],
callback=changes_detected)
core.add_spacing(count=5)
"""
Apply Configuration to the database Button
"""
core.add_button("Apply Configuration", callback=save_data)
"""
Start the Overlay with the current configuration
"""
core.add_spacing(count=3)
core.add_button("Start", callback=open_overlay)
core.set_item_style_var("Start", mvGuiStyleVar_FramePadding, [5 * 29.5, 5 * 3])
with simple.window('##Config', no_collapse=True, no_resize=True, no_move=True, no_close=True, x_pos=0, y_pos=1,
width=20, height=790, no_title_bar=True):
core.set_item_color("##Config", mvGuiCol_Text,
color=(COLOR_List[1][0], COLOR_List[1][1], COLOR_List[1][2], COLOR_List[1][3]))
core.set_item_color("##Config", mvGuiCol_WindowBg,
color=(COLOR_List[3][0], COLOR_List[3][1], COLOR_List[3][2], COLOR_List[3][3] - 10))
core.set_item_style_var("##Config", mvGuiStyleVar_WindowRounding, value=[6])
core.set_item_color("##Config", mvGuiCol_Border,
color=(COLOR_List[4][0], COLOR_List[4][1], COLOR_List[4][2], COLOR_List[4][3]))
core.add_image_button("##ConfigPlus", value="resources/cfg_wheel.png",
callback=animation_config_color, frame_padding=1,
tip="Settings & Colors")
core.add_same_line(xoffset=50)
with simple.group("##Config_Colors", show=False):
COLOR_List = config_functions.get_color()
core.add_text("You can type in the RBG Values or click on the right Color Button")
core.add_color_edit4(name="Header#Color",
default_value=[COLOR_List[0][0], COLOR_List[0][1], COLOR_List[0][2], COLOR_List[0][3]],
label="Header")
core.add_color_edit4(name="Text#Color",
default_value=[COLOR_List[1][0], COLOR_List[1][1], COLOR_List[1][2], COLOR_List[1][3]],
label="Text")
core.add_color_edit4(name="ButtonActive#Color",
default_value=[COLOR_List[2][0], COLOR_List[2][1], COLOR_List[2][2], COLOR_List[2][3]],
label="Button Active")
core.add_color_edit4(name="BG#Color",
default_value=[COLOR_List[3][0], COLOR_List[3][1], COLOR_List[3][2], COLOR_List[3][3]],
label="Background")
core.add_color_edit4(name="Outline#Color",
default_value=[COLOR_List[4][0], COLOR_List[4][1], COLOR_List[4][2], COLOR_List[4][3]],
label="Outline")
core.add_separator()
core.add_button("Test Colors", callback=test_colors)
core.add_same_line()
core.add_button("Reset", callback=reset_colors)
core.add_button("Save Colors", callback=save_colors)
core.add_spacing(count=2)
core.add_separator()
core.add_separator()
core.add_spacing(count=2)
scale = config_functions.get_scale()
core.set_global_font_scale(scale)
core.add_text("Change The Global Font Size")
core.add_drag_float("Global Scale", default_value=scale, format="%0.2f", speed=0.01,
callback=lambda sender, data: core.set_global_font_scale(
core.get_value("Global Scale")))
core.add_button("Reset##1", callback=reset_scale)
core.add_button("Save Size##1", callback=save_scale)
core.add_spacing(count=2)
core.add_separator()
core.add_separator()
core.add_spacing(count=2)
refresh = config_functions.get_refresh()
refreshSymbol = config_functions.get_refresh_sign()
core.add_text("Change The refresh time for the Overlay ( in seconds )")
core.add_input_int("##RefreshTime", default_value=refresh, min_value=5, step=0)
core.add_button("Save refresh time##1", callback=save_refresh_time)
if refreshSymbol in "True":
refreshSymbol = True
else:
refreshSymbol = False
core.add_spacing(count=2)
core.add_text("Enable, Disable the refresh sign in the overlay")
core.add_checkbox("Refresh Symbol##RefreshTime", default_value=refreshSymbol,
callback=refresh_symbol)
core.add_separator()
core.add_separator()
core.add_button("Close##Color", callback=animation_config_color)
core.add_spacing(count=3)
core.add_image_button("##ConfigWeb", value="resources/web.png",
callback=animation_config_web, frame_padding=1,
tip="Web")
core.add_spacing(count=2)
core.add_image_button("##ConfigQuestion", value="resources/q.png",
callback=animation_config_help, frame_padding=1,
tip="Help")
core.add_same_line(xoffset=50)
with simple.group("##Web", show=False):
web = webFunctions.get_web()
web_parameters = webHandler.get_web_parameters()
print(web_parameters)
bgimage = ""
core.add_text("Browser Settings")
core.add_checkbox("Open in Browser Only##Browser", default_value=web[0],
callback=lambda sender, data: save_web())
core.add_same_line()
core.add_checkbox("Open in Browser and App##Browser", default_value=web[1],
callback=lambda sender, data: save_web())
core.add_spacing(count=2)
core.add_text("Text Size (pixel)")
core.add_input_int("##BrowserTextSize", default_value=web_parameters[0][0],
min_value=5, step=0, callback=save_font)
core.add_text("Text Font:")
core.add_combo("Font Family##Web", items=WEB_FONT,
default_value=web_parameters[0][1], callback=save_font)
core.add_spacing(count=2)
core.add_text(name="Background Image##Web", default_value="Background Image")
core.add_input_text("##BgImage", default_value=web_parameters[0][2], readonly=True)
core.add_button("Search Background Image##Web", callback=openFileDialog.get_background_image,
callback_data=bgimage)
core.add_same_line()
core.add_button("Delete Background Image##Web",
callback=lambda sender, data: core.set_value("##BgImage", ""))
core.add_separator()
core.add_separator()
core.add_button("Close##Web", callback=animation_config_web)
with simple.group("##Help", show=False):
core.add_text("OUTDATED, WILL BE UPDATED IN THE NEXT RELEASE")
core.add_input_text("##HelpIntroText", multiline=True, readonly=True, height=110, width=340,
default_value="Welcome to the help page of the Faceit Overlay\n"
"here the options and different possibilities are\n"
"explained to you.\n"
"Here is a small overview;\n"
"1: Start menu\n"
"2: Color configuration\n"
"3: Overlay"
)
core.add_spacing(count=2)
core.add_text("1: Start menu")
core.add_image("##StartmenuImage", value="resources/start_menu.png")
core.add_input_text("##HelpStartMenuText", multiline=True, height=70, width=340, readonly=True,
default_value="The start menu is the configuration menu\n"
"Here you can change colors, global size\n"
"Enable / disable stats you want to see\n"
"and start the Overlay"
)
core.add_spacing(count=2)
core.add_text("2: Color configuration")
core.add_image("##ColorconfImage", value="resources/color_config.png")
core.add_input_text("##HelpColorConfigText", multiline=True, height=220, width=340, readonly=True,
default_value="Here you can adjust the colors according to your own taste.\n"
"The buttons have the following functions:\n\n"
"Test Color: Sets the color for the menu so that you can check it.\n"
"Reset Color: Sets the colors back to the default value.\n"
"Save Color: Saves the colors so that they will be kept\n"
"\t\t\t\t\t on the next startup.\n\n"
"To adjust the global size of the texts and heads you can move \n"
"the slider to the left or right and then use the buttons \n"
"to perform the following functions:\n\n"
"Reset: Set the size back to 1.0\n"
"Save Size: Save the global size for the next start up"
)
core.add_spacing(count=2)
core.add_text("3: Overlay")
core.add_image("##OverlayImage", value="resources/overlay.png")
core.add_input_text("##HelpOverlayText", multiline=True, height=100, width=340, readonly=True,
default_value="The overlay has basically no functionalities except \n"
"that it updates itself regularly (every 60 seconds) \n"
"and thus adjusts the values.\n"
"But if you click on the headers \n"
"FACEIT STATS | LAST GAME you get back to the start screen.\n"
)
core.add_button("Close##Help", callback=animation_config_help)
""" ---------------------------------------------------------------------------------------------------------------
START DPG
-------------------------------------------------------------------------------------------------------------"""
core.enable_docking(dock_space=False)
core.start_dearpygui(primary_window="FACEIT Elo Overlay")
if __name__ == "__main__":
__version__ = '0.2'
__author__ = 'Marco Studer'
functions.init_logger("overlay")
start_build_dpg()