-
Notifications
You must be signed in to change notification settings - Fork 0
/
BookerDB.py
executable file
·2178 lines (1530 loc) · 65.1 KB
/
BookerDB.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
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/usr/bin/env python3
# BookerDB - Open Source Show Management System
from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import A4
import csv
import os
import datetime
import subprocess
from subprocess import call
import webbrowser
from re import split
from tkinter import *
from tkinter import ttk
from tkinter import messagebox
from tkinter.font import Font
import tkinter.font as font
from ttkthemes import ThemedTk
version = "0.3.0"
data_file = "data.csv"
monitor_presets_sel = StringVar
tour = StringVar
tour_sum = StringVar
exportpath = StringVar
money_sum_string = StringVar
coming_fee = 0.0
coming_fee_add = 0.0
date = StringVar
city = StringVar
venue = StringVar
date_time = str(datetime.datetime.now())
today = date_time[:10]
pdf_ypos = +20
newest_backup = "data.startbak"
white = "#ffffff"
black = "#000000"
textcolor = "black"
selecttextcolor = "white"
selectbgcolor = "grey"
preset_list = ("COMING", "COMING + Artist", "PLAYED", "PLAYED + Artist", "WAITING FOR MONEY", "CANCELLED", "WORK IN PROGRESS", "CONTACT ONLY",
"Statistics", "Notes", "Actual States", "Cities", "Countries", "Artists", "Venues", "Fees", "Contacts", "Info",
"E-Mails", "COMING E-Mails", "PLAYED E-Mails","WAITING E-Mails","CANCELLED E-Mails", "IN PROGRESS E-Mails","CONTACT ONLY E-Mails",
"Address", "Address Print", "Print", "Database Monitor",
"Tour", "Tour2", "Tour3", "Tour4", "Tour5", "Tour6")
state_list = ("COMING", "PLAYED", "WAITING FOR MONEY", "CANCELLED", "WORK IN PROGRESS", "CONTACT ONLY")
# about
def about_app():
messagebox.showinfo("About", "BookerDB " + version + "\nby Vincent Rateau\nwww.sonejo.net\n\nLicensed under GPL 3.0")
def website():
webbrowser.open_new_tab("https://github.com/sonejostudios/BookerDB")
# sync address
def sync_address_dialog():
result = messagebox.askquestion(
"Sync", "This will sync and replace all Addresses for this Venue in this City. This will replace Street, No, ZIP and Country.\n\n"
"Are you sure?\n\nThis will also save and trigger a backup before changements.", icon='warning')
if result == 'yes':
database_backup()
sync_entries(0)
else:
pass
def sync_contact_dialog():
result = messagebox.askquestion(
"Sync", "This will sync and replace all Contact Entries for this Venue in this City. This will replace Contact, Phone and E-Mail.\n\n"
"Are you sure?\n\nThis will also save and trigger a Backup before changements.", icon='warning')
if result == 'yes':
database_backup()
sync_entries(1)
else:
pass
def sync_entries(x):
print("sync address")
venue = venue_entry.get()
city = city_entry.get()
with open('data.csv', 'r') as f, open('temp.csv', 'w') as fw:
reader = csv.reader(f)
writer = csv.writer(fw)
for row in reader:
if venue == row[2] and x == 0:
if city == row[1]:
row[4] = street_entry.get()
row[5] = no_entry.get()
row[6] = zip_entry.get()
row[7] = country_entry.get()
if venue == row[2] and x == 1:
if city == row[1]:
row[8] = contact_entry.get()
row[9] = phone_entry.get()
row[10] = email_entry.get()
# print(row)
# write the row back into temp file
writer.writerow(row)
# copy temp to data and replace it
os.system("cp temp.csv data.csv")
# update show list
read_tour()
notify("All Venue's Addresses synchronized.")
# set shortcuts
def shortcut_focus_search(event):
search_entry.focus()
def shortcut_focus_filter(event):
filter_entry.focus()
def shortcut_focus_artist(event):
artist_entry.focus()
def shortcut_focus_monitorpresets(event):
monitor_presets.focus()
def shortcut_focus_showlist(event):
gig_listbox.focus()
def shortcut_save(event):
on_replace_click()
def shortcut_delete(event):
on_delete_entry_click()
def shortcut_add(event):
on_add_click()
def shortcut_clear(event):
on_clear_text()
def shortcut_backup(event):
database_backup()
def shortcut_texteditor(event):
open_monitor_textedit()
def shortcut_osm(event):
show_osm()
def shortcut_gmaps(event):
show_gmaps()
def shortcut_ddgo(event):
web_ddgo()
def shortcut_g(event):
web_g()
def shortcut_mail(event):
mailto()
# search show in listbox
def search_auto(event):
search_show()
def search_show():
search_item = search_entry.get()
total_line_count = str(sum(1 for line in open(data_file)))
orig_color = gig_listbox.cget("background")
first_search = 0
if search_item != "":
for i in range(int(total_line_count)) :
gig_listbox_content = gig_listbox.get(i)
if search_item in gig_listbox_content:
gig_listbox.itemconfig(i, bg="grey", fg="white")
# at first iteration only, jump to see first highlighted show
if first_search == 0:
gig_listbox.see(i)
first_search = 1
else:
gig_listbox.itemconfig(i, bg=orig_color, fg="black")
else:
for i in range(int(total_line_count)):
gig_listbox.itemconfig(i, bg=orig_color, fg="black")
#filter monitor
def filter_auto(event):
read_tour()
filter_monitor()
#trigger search
filter_item = filter_entry.get()
search_entry.delete(0,END)
search_entry.insert(0, filter_item)
search_show()
#search_entry.delete(0, END)
def filter_monitor():
filter_item = filter_entry.get()
monitor_header = monitor.get(0.0,2.0)
monitor_content = monitor.get(2.0,END)
if filter_item != "":
monitor.delete(0.0, END)
for line in monitor_content.split("\n"):
if filter_item in line:
monitor.insert(END, line + "\n")
monitor.insert(0.0, monitor_header + "\n")
### ------ CONFIG ------- ####
def write_config():
exportpath = str(exportpath_entry.get())
configfile = open("config.csv", "w")
configfile.write(exportpath)
configfile.close()
def read_config():
configfile = open("config.csv", "r")
exportpath = configfile.read()
# set path in exportpath_entry
exportpath_entry.delete(0, END)
exportpath_entry.insert(0, exportpath)
configfile.close()
# print do nothing
def do_nothing():
print("do nothing")
pass
#notify
def notify(message):
#os.system('notify-send "{}" "{}"'.format("BookerDB", message))
rootdir = os.path.dirname(os.path.realpath(__file__))
os.system('notify-send -i "{}" "{}" "{}"'.format(rootdir + "/logo/logo.png", "BookerDB", message))
# focus next widget
def focus_next_window(event):
event.widget.tk_focusNext().focus()
return("break")
# check if os command exists
def cmd_exists(cmd):
return subprocess.call("type " + cmd, shell=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE) == 0
# on quit
def on_quit():
workdir = exportpath_entry.get()
# save export path into config.csv
write_config()
try:
file = open(workdir + "data.workdir.csv.lok", "r")
messagebox.showerror("Remote DB", "The Remote Database in the Working Folder is locked !\nPlease Export it back.")
except:
root.quit()
# check environement and set file browser
def set_env():
# save export path into config.csv
write_config()
if cmd_exists("caja") == TRUE: # MATE
return "caja"
elif cmd_exists("nemo") == TRUE: # Cinnamon
return "nemo"
elif cmd_exists("nautilus") == TRUE: # GNOME
return "nautilus"
elif cmd_exists("dolphin") == TRUE: # KDE
return "dolphin"
else:
messagebox.showerror("Error", "No file browser detected.")
# open workdir
def open_workdir():
workdir = exportpath_entry.get()
filebrowser = set_env()
call(filebrowser + " " + workdir, shell=TRUE) # better than os.system
def open_bakdir():
bakdir = os.path.dirname(os.path.realpath(__file__))
filebrowser = set_env()
call(filebrowser + " " + bakdir + "/bak", shell=TRUE)
def open_rootdir():
rootdir = os.path.dirname(os.path.realpath(__file__))
filebrowser = set_env()
call(filebrowser + " " + rootdir, shell=TRUE)
# remote database
def export_to_workdir():
workdir = exportpath_entry.get()
os.system("cp data.csv " + workdir + "data.workdir.csv")
os.system("rm " + workdir + "data.workdir.csv.lok ")
notify("Database exported to Working Folder.\nRemote DB unlocked.")
def import_from_workdir():
workdir = exportpath_entry.get()
try:
file = open(workdir + "data.workdir.csv", "r")
os.system("cp " + workdir + "data.workdir.csv data.csv")
os.system("mv " + workdir + "data.workdir.csv " + workdir + "data.workdir.csv.lok")
notify("Database imported from Working Folder.\nRemote DB locked.")
except:
messagebox.showerror("Database", "Database in Workdir is locked !\nTry again later...")
read_csv_line()
# check state and do warnings or focus
def state_check(event):
print("state selected")
if statebox_entry.get() == "CONTACT ONLY":
messagebox.showwarning("Info", "CONTACT ONLY will delete the date when saved or added.")
elif statebox_entry.get() != "CONTACT ONLY" and date_entry.get() == "9999-99-99":
#date_entry.delete(0,END)
date_entry.focus_set()
# maps
def show_osm():
show_map("osm")
def show_gmaps():
show_map("gmaps")
def show_map(x):
city = city_entry.get()
city2 = city.replace(" ", "+")
street = street_entry.get()
street2 = street.replace(" ","+")
nr = no_entry.get()
nr2 = nr.replace(" ","+")
country = country_entry.get()
country2 = country.replace(" ", "+")
# osm
if x == "osm":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!osm+" + country2 + "+" + city2 + "+" + street2 + "+" + nr2)
# gmaps
else:
webbrowser.open_new_tab("https://duckduckgo.com/?q=!m+" + country2 + "+" + city2 + "+" + street2 + "+" + nr2)
# web search
def web_ddgo():
websearch("ddgo")
def web_g():
websearch("g")
def web_images():
websearch("images")
def web_yt():
websearch("yt")
def web_fb():
websearch("fb")
def web_sc():
websearch("sc")
def mailto():
websearch("mailto")
def websearch(x):
venue = venue_entry.get()
city = city_entry.get()
country = country_entry.get()
email = email_entry.get()
if x == "ddgo":
webbrowser.open_new_tab("https://duckduckgo.com/?q=" + venue + "+" + city + "+" + country)
elif x == "g":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!g+" + venue + "+" + city + "+" + country)
elif x == "images":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!i+" + venue + "+" + city + "+" + country)
elif x == "yt":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!yt+" + venue + "+" + city + "+" + country)
elif x == "fb":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!fb+" + venue + "+" + city + "+" + country)
elif x == "sc":
webbrowser.open_new_tab("https://duckduckgo.com/?q=!sc+" + venue + "+" + city + "+" + country)
elif x == "mailto":
webbrowser.open_new_tab("mailto:" + email)
# statistics
def stats():
monitor.delete(0.0, END)
# set var
fee_sum = 0.0
travelmoney_sum = 0.0
coming_fee = 0.0
played_fee = 0.0
cancelled_fee = 0.0
waiting_fee = 0.0
wip_fee = 0.0
contact_fee = 0.0
coming_count = 0
played_count = 0
cancelled_count = 0
waiting_count = 0
wip_count = 0
contact_count = 0
waiting_travelmoney = 0.0
# monitor view presets
monitor_presets_sel = monitor_presets.get()
if monitor_presets_sel == "Statistics":
with open('data.csv', 'r') as f:
reader = csv.reader(f, delimiter=',')
for row in reader:
fee = row[19]
fee_nb = fee[:-3]
fee_float = float(fee_nb)
fee_sum += fee_float
travelmoney = row[20]
travelmoney_nb = travelmoney[:-3]
travelmoney_float = float(travelmoney_nb)
travelmoney_sum += travelmoney_float
travelmoney_sum2 = "%.2f" % travelmoney_sum
state = int(row[32])
if state == 0:
coming_fee += fee_float
coming_count += 1
if state == 1:
played_fee += fee_float
played_count += 1
if state == 2:
waiting_fee += fee_float
waiting_travelmoney += travelmoney_float
waiting_count += 1
if state == 3:
cancelled_fee += fee_float
cancelled_count += 1
if state == 4:
wip_fee += fee_float
wip_count += 1
if state == 5:
contact_fee += fee_float
contact_count += 1
total_line_count = str(sum(1 for line in open(data_file)))
fee_sum2 = "%.2f" % fee_sum
currency = str(fee[-4:])
waiting_fee_travel_sum = float(waiting_fee) + float(waiting_travelmoney)
waiting_fee_travel_sum2 = "%.2f" % waiting_fee_travel_sum
fee_sum_played_waiting = played_fee + waiting_fee
count_sum_played_waiting = played_count + waiting_count
monistats = "COMING - Shows : " + str(coming_count) + "\n" + \
"COMING - Fee : " + str(coming_fee) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"PLAYED - Shows : " + str(played_count) + "\n" + \
"PLAYED - Fee : " + str(played_fee) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"PLAYED+WAITING - Shows : " + str(count_sum_played_waiting) + "\n" + \
"PLAYED+WAITING - Fee: " + str(fee_sum_played_waiting) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"WAITING FOR MONEY - Shows : " + str(waiting_count) + "\n" + \
"WAITING FOR MONEY - Fee : " + str(waiting_fee) + currency + "\n" + \
"WAITING FOR MONEY - Fee+Travel : " + str(waiting_fee_travel_sum2) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"CANCELLED - Shows : " + str(cancelled_count) + "\n" + \
"CANCELLED - Fee : " + str(cancelled_fee) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"WORK IN PROGRESS - Amount : " + str(wip_count) + "\n" + \
"WORK IN PROGRESS - Fee : " + str(wip_fee) + currency + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"CONTACT ONLY - Amount : " + str(contact_count) + "\n\n" + \
"-----------------------------------" + "\n\n" + \
"Entries in Database : " + total_line_count + "\n\n" + \
"-----------------------------------" + "\n"
monitor.insert(END, monistats)
monitor.insert(END, "\n")
### ------ READ-WRITE DB ------- ####
# read "tour" for listbox and monitor
def read_tour():
# delete listbox and monitor
gig_listbox.delete(0, END)
monitor.delete(0.0, END)
with open(data_file, 'r') as datafile:
reader = csv.reader(datafile)
for row in reader:
date = str(row[0])
city = str(row[1])
venue = str(row[2])
artist = str(row[3])
street = str(row[4])
nr = str(row[5])
zip = str(row[6])
country = str(row[7])
contact = str(row[8])
phone = str(row[9])
email = str(row[10])
info = str(row[11]) + " " + str(row[12]) + " " + str(row[13]) + " " + str(row[14]) + " " + str(row[15]) + " " + str(row[16]) + " " + str(row[17]) + " " + str(row[18])
fee = str(row[19])
travelmoney = str(row[20])
currency = str(fee[-4:])
fee_float = float(fee[:-3])
travelmoney_float = float(travelmoney[:-3])
fee_sum = fee_float + travelmoney_float
prints = str(row[27])
addressprint1 = str(row[28])
addressprint2 = str(row[29])
addressprint3 = str(row[30])
addressprint4 = str(row[31])
statebox = state_list[int(row[32])]
#insert in listbox special formatting for states
if statebox == "CONTACT ONLY":
tour = " " + city + " (" + country + ")" + " - " + venue
elif statebox == "WORK IN PROGRESS":
if date != "9999-99-99":
tour = "-> " + date + " - " + city + " - " + venue + " - " + artist
else:
tour = "-> " + city + " (" + country + ")" + " - " + venue
elif statebox == "WAITING FOR MONEY":
tour = " $ " + date + " - " + city + " - " + venue + " - " + artist
elif statebox == "CANCELLED":
tour = " # " + date + " - " + city + " - " + venue + " - " + artist
else:
tour = date + " - " + city + " - " + venue + " - " + artist
gig_listbox.insert(END, tour)
#monitor view presets
monitor_presets_sel = monitor_presets.get()
if monitor_presets_sel == "Tour":
tour = date + " - " + city + " - " + venue + "\n"
elif monitor_presets_sel == "Tour2":
tour = date + " - " + city + " - " + venue + " - " + artist + "\n"
elif monitor_presets_sel == "Tour3":
tour = date + " " + city + " " + venue + "\n"
elif monitor_presets_sel == "Tour4":
tour = date + "\n" + city + "\n" + venue + "\n" + "\n"
elif monitor_presets_sel == "Tour5":
tour = date + "\n" + city + ", " + venue + "\n" + "\n"
elif monitor_presets_sel == "Tour6":
tour = date + " \n" + city + " - " + venue + "\n" + "\n"
elif monitor_presets_sel == "Contacts":
tour = venue + " (" + city + " - " + date + " - " + artist + ") : " + contact + " : " + phone + " - " + email + "\n" + "\n"
elif monitor_presets_sel == "Info":
tour = date + " - " + city + " - " + venue + " : " + info + "\n" + "\n"
elif monitor_presets_sel == "Print":
tour = city + " - " + venue + " (" + artist + ") -> " + prints + "\n" + "\n"
elif monitor_presets_sel == "Address":
tour = venue + " : " + street + " " + nr + ", " + zip + " " + city + ", " + country + "\n" + "\n"
elif monitor_presets_sel == "Address Print":
tour = venue + " : " + addressprint1 + ", " + addressprint2 + ", " + addressprint3 + ", " + addressprint4 + "\n" + "\n"
elif monitor_presets_sel == "Statistics":
pass
elif monitor_presets_sel == "Actual States":
tour = date + " - " + city + " - " + venue + " (" + artist + ") : " + statebox + "\n"
elif monitor_presets_sel == "COMING":
if statebox == "COMING":
tour = date + " - " + city + " - " + venue + "\n"
else:
tour = ""
elif monitor_presets_sel == "COMING + Artist":
if statebox == "COMING":
tour = date + " - " + city + " - " + venue + " - " + artist + "\n"
else:
tour = ""
elif monitor_presets_sel == "PLAYED":
if statebox == "PLAYED":
tour = date + " - " + city + " - " + venue + "\n"
else:
tour = ""
elif monitor_presets_sel == "PLAYED + Artist":
if statebox == "PLAYED":
tour = date + " - " + city + " - " + venue + " - " + artist + "\n"
else:
tour = ""
elif monitor_presets_sel == "CANCELLED":
if statebox == "CANCELLED":
tour = date + " - " + city + " - " + venue + " - " + artist + "\n"
else:
tour = ""
elif monitor_presets_sel == "WAITING FOR MONEY":
if statebox == "WAITING FOR MONEY":
tour = date + " - " + city + " - " + venue + " - " + artist + " : " + str(fee_sum) + currency + "\n"
else:
tour = ""
elif monitor_presets_sel == "WORK IN PROGRESS":
if statebox == "WORK IN PROGRESS":
tour = date + " - " + city + " - " + venue + " - " + artist + " : " + str(fee_sum) + currency + "\n"
else:
tour = ""
elif monitor_presets_sel == "CONTACT ONLY":
if statebox == "CONTACT ONLY":
tour = city + " (" + country + ") - " + venue + " - " + artist + "\n"
else:
tour = ""
elif monitor_presets_sel == "Cities":
tour = city + " (" + country + ")" + " - " + venue + " (" + artist + " - " + date + ")" + " - " + fee + "\n"
elif monitor_presets_sel == "Countries":
tour = country + " - " + city + " - " + venue + " (" + artist + " - " + date + ")" + " - " + fee + "\n"
elif monitor_presets_sel == "Artists":
tour = artist + " - " + city + " (" + country + ")" + " - " + venue + " (" + date + ")" + " - " + fee + "\n"
elif monitor_presets_sel == "Venues":
tour = venue + " (" + city + " - " + country + ") - " + date + " (" + artist + ")" + " - " + fee + "\n"
elif monitor_presets_sel == "Fees":
tour = fee + " / " + travelmoney + " - " + venue + " - " + city + " - " + date + " (" + artist + ")" + "\n"
elif monitor_presets_sel == "Notes":
tour = ""
pass
elif monitor_presets_sel == "E-Mails":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
elif monitor_presets_sel == "COMING E-Mails":
if statebox == "COMING":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
elif monitor_presets_sel == "PLAYED E-Mails":
if statebox == "PLAYED":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
elif monitor_presets_sel == "WAITING E-Mails":
if statebox == "WAITING FOR MONEY":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
elif monitor_presets_sel == "CANCELLED E-Mails":
if statebox == "CANCELLED":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
elif monitor_presets_sel == "CONTACT ONLY E-Mails":
if statebox == "CONTACT ONLY":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
elif monitor_presets_sel == "IN PROGRESS E-Mails":
if statebox == "WORK IN PROGRESS":
if email != "":
tour = contact + " <" + email + ">\n"
else:
tour = ""
else:
tour = ""
else:
tour = date + " - " + city + " - " + venue + "\n"
monitor.insert(END, tour)
#calculate stats
if monitor_presets_sel == "Statistics":
stats()
else:
tour = date + " - " + city + " - " + venue
#insert title in monitor
if monitor_presets_sel == "COMING":
monitor.insert(0.0, "COMING (" + today + ") :\n\n")
if monitor_presets_sel == "COMING + Artist":
monitor.insert(0.0, "COMING + Artist (" + today + ") :\n\n")
if monitor_presets_sel == "PLAYED":
monitor.insert(0.0, "PLAYED (" + today + ") :\n\n")
if monitor_presets_sel == "PLAYED + Artist":
monitor.insert(0.0, "PLAYED + Artist (" + today + ") :\n\n")
if monitor_presets_sel == "CANCELLED":
monitor.insert(0.0, "CANCELLED (" + today + ") :\n\n")
if monitor_presets_sel == "WAITING FOR MONEY":
monitor.insert(0.0, "WAITING FOR MONEY : Fee + Travel (" + today + ") :\n\n")
if monitor_presets_sel == "WORK IN PROGRESS":
monitor.insert(0.0, "WORK IN PROGRESS (" + today + ") :\n\n")
if monitor_presets_sel == "CONTACT ONLY":
monitor.insert(0.0, "CONTACT ONLY (" + today + ") :\n\n")
if monitor_presets_sel == "Actual States":
monitor.insert(0.0, "Actual States (" + today + ") :\n\n")
if monitor_presets_sel == "Statistics":
monitor.insert(0.0, "Statistics (" + today + ") :\n\n")
if monitor_presets_sel == "Contacts":
monitor.insert(0.0, "Contacts (" + today + ") :\n\n")
if monitor_presets_sel == "Info":
monitor.insert(0.0, "Info (" + today + ") :\n\n")
if monitor_presets_sel == "Print":
monitor.insert(0.0, "Print (" + today + ") :\n\n")
# reorder cities
if monitor_presets_sel == "Cities":
temp_dump_read()
monitor.insert(0.0, "Cities (" + today + ") :\n\n")
# reorder countries
if monitor_presets_sel == "Countries":
temp_dump_read()
monitor.insert(0.0, "Countries (" + today + ") :\n\n")
# reorder artists
if monitor_presets_sel == "Artists":
temp_dump_read()
monitor.insert(0.0, "Artists (" + today + ") :\n\n")
# reorder venues
if monitor_presets_sel == "Venues":
temp_dump_read()
monitor.insert(0.0, "Venues (" + today + ") :\n\n")
# reorder fees
if monitor_presets_sel == "Fees":
temp_dump_read()
monitor.insert(0.0, "Fees / Travel Money (" + today + ") :\n\n")
if monitor_presets_sel == "Address":
monitor.insert(0.0, "Adresses (" + today + ") :\n\n")
if monitor_presets_sel == "Address Print":
monitor.insert(0.0, "Adresses for Print (" + today + ") :\n\n")
if monitor_presets_sel == "Notes":
read_notes()
if monitor_presets_sel == "E-Mails":
monitor.insert(0.0, "E-Mails (All) (" + today + ") :\n\n")
if monitor_presets_sel == "COMING E-Mails":
monitor.insert(0.0, "COMING - E-Mails (" + today + ") :\n\n")
if monitor_presets_sel == "PLAYED E-Mails":
monitor.insert(0.0, "PLAYED - E-Mails (" + today + ") :\n\n")
if monitor_presets_sel == "WAITING E-Mails":
monitor.insert(0.0, "WAITING FOR MONEY - E-Mails (" + today + ") :\n\n")
if monitor_presets_sel == "CANCELLED E-Mails":
monitor.insert(0.0, "CANCELLED - E-Mails (" + today + ") :\n\n")
if monitor_presets_sel == "IN PROGRESS E-Mails":
monitor.insert(0.0, "WORK IN PROGRESS - E-Mails (" + today + ") :\n\n")
if monitor_presets_sel == "CONTACT ONLY E-Mails":
monitor.insert(0.0, "CONTACT ONLY - E-Mails (" + today + ") :\n\n")
# start search
search_show()
# start filter
filter_monitor()
# Specials for Notes
def read_notes():
# open notes
notefile = open("notes.txt", "r")
tour = notefile.read()
monitor.insert(0.0, tour)
notefile.close()
print("read Notes")
def write_notes(event):
# write notes igf monitor == Notes
monitor_presets_sel = monitor_presets.get()
if monitor_presets_sel == "Notes":
# save notes
notefile = open("notes.txt", "w")
notefile.write(monitor.get(0.0, END))
notefile.close()
print("write Notes")