@@ -71,7 +71,11 @@ def About():
71
71
top .geometry ('310x240' )
72
72
top .title ('About' )
73
73
try : top .iconbitmap ('ObsPlanner.ico' ) #win
74
- except : pass
74
+ except :
75
+ try : #linux
76
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
77
+ top .tk .call ('wm' ,'iconphoto' ,top ._w ,img )
78
+ except : pass
75
79
top .resizable (False ,False )
76
80
top .configure (background = colors ['window' ])
77
81
@@ -208,12 +212,16 @@ def detect():
208
212
messagebox .showwarning ('Constellation' ,'Multiple possible constellations detected (' + ', ' .join (found )+ ')! Please, add it manually.' )
209
213
top .lift ()
210
214
211
- top = tk .Tk ()
215
+ top = tk .Toplevel ()
212
216
top .lift ()
213
217
top .geometry ('250x350' )
214
218
top .title ('Object' )
215
219
try : top .iconbitmap ('ObsPlanner.ico' ) #win
216
- except : pass
220
+ except :
221
+ try : #linux
222
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
223
+ top .tk .call ('wm' ,'iconphoto' ,top ._w ,img )
224
+ except : pass
217
225
top .resizable (False ,False )
218
226
top .configure (background = colors ['window' ])
219
227
@@ -400,12 +408,17 @@ def saveObs():
400
408
topObs .destroy ()
401
409
top .lift ()
402
410
403
- topObs = tk .Tk ()
411
+ topObs = tk .Toplevel ()
404
412
topObs .lift ()
405
413
topObs .geometry ('300x80' )
406
414
topObs .title ('Observer' )
407
415
try : topObs .iconbitmap ('ObsPlanner.ico' ) #win
408
- except : pass
416
+ except :
417
+ try : #linux
418
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
419
+ topObs .tk .call ('wm' ,'iconphoto' ,topObs ._w ,img )
420
+ except : pass
421
+ topObs .configure (background = colors ['window' ])
409
422
topObs .resizable (False ,False )
410
423
411
424
obsNameVar = tk .StringVar (topObs )
@@ -446,12 +459,17 @@ def saveLims():
446
459
topLims .destroy ()
447
460
topSite .lift ()
448
461
449
- topLims = tk .Tk ()
462
+ topLims = tk .Toplevel ()
450
463
topLims .lift ()
451
464
topLims .geometry ('400x150' )
452
465
topLims .title ('Limits' )
453
466
try : topLims .iconbitmap ('ObsPlanner.ico' ) #win
454
- except : pass
467
+ except :
468
+ try : #linux
469
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
470
+ topLims .tk .call ('wm' ,'iconphoto' ,topLims ._w ,img )
471
+ except : pass
472
+ topLims .configure (background = colors ['window' ])
455
473
topLims .resizable (False ,False )
456
474
457
475
minAltVar = tk .DoubleVar (topLims )
@@ -550,12 +568,17 @@ def saveSite():
550
568
topSite .destroy ()
551
569
top .lift ()
552
570
553
- topSite = tk .Tk ()
571
+ topSite = tk .Toplevel ()
554
572
topSite .lift ()
555
573
topSite .geometry ('230x200' )
556
574
topSite .title ('Site' )
557
575
try : topSite .iconbitmap ('ObsPlanner.ico' ) #win
558
- except : pass
576
+ except :
577
+ try : #linux
578
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
579
+ topSite .tk .call ('wm' ,'iconphoto' ,topSite ._w ,img )
580
+ except : pass
581
+ topSite .configure (background = colors ['window' ])
559
582
topSite .resizable (False ,False )
560
583
561
584
siteNameVar = tk .StringVar (topSite )
@@ -650,12 +673,17 @@ def saveTel():
650
673
topTel .destroy ()
651
674
top .lift ()
652
675
653
- topTel = tk .Tk ()
676
+ topTel = tk .Toplevel ()
654
677
topTel .lift ()
655
678
topTel .geometry ('400x80' )
656
679
topTel .title ('Telescope' )
657
680
try : topTel .iconbitmap ('ObsPlanner.ico' ) #win
658
- except : pass
681
+ except :
682
+ try : #linux
683
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
684
+ topTel .tk .call ('wm' ,'iconphoto' ,topTel ._w ,img )
685
+ except : pass
686
+ topTel .configure (background = colors ['window' ])
659
687
topTel .resizable (False ,False )
660
688
661
689
telNameVar = tk .StringVar (topTel )
@@ -760,12 +788,17 @@ def detect():
760
788
constVar .set (const )
761
789
return
762
790
763
- topObj = tk .Tk ()
791
+ topObj = tk .Toplevel ()
764
792
topObj .lift ()
765
793
topObj .geometry ('250x350' )
766
794
topObj .title ('Object' )
767
795
try : topObj .iconbitmap ('ObsPlanner.ico' ) #win
768
- except : pass
796
+ except :
797
+ try : #linux
798
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
799
+ topObj .tk .call ('wm' ,'iconphoto' ,topObj ._w ,img )
800
+ except : pass
801
+ topObj .configure (background = colors ['window' ])
769
802
topObj .resizable (False ,False )
770
803
771
804
nameVar = tk .StringVar (topObj )
@@ -980,12 +1013,17 @@ def saveObs():
980
1013
top .destroy ()
981
1014
root .lift ()
982
1015
983
- top = tk .Tk ()
1016
+ top = tk .Toplevel ()
984
1017
top .lift ()
985
1018
top .geometry ('450x400' )
986
1019
top .title ('Observation' )
987
1020
try : top .iconbitmap ('ObsPlanner.ico' ) #win
988
- except : pass
1021
+ except :
1022
+ try : #linux
1023
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1024
+ top .tk .call ('wm' ,'iconphoto' ,top ._w ,img )
1025
+ except : pass
1026
+ top .configure (background = colors ['window' ])
989
1027
top .resizable (False ,False )
990
1028
991
1029
observerVar = tk .StringVar (top )
@@ -1327,12 +1365,17 @@ def saveObs():
1327
1365
topObs .destroy ()
1328
1366
top .lift ()
1329
1367
1330
- topObs = tk .Tk ()
1368
+ topObs = tk .Toplevel ()
1331
1369
topObs .lift ()
1332
1370
topObs .geometry ('300x80' )
1333
1371
topObs .title ('Observer' )
1334
1372
try : topObs .iconbitmap ('ObsPlanner.ico' ) #win
1335
- except : pass
1373
+ except :
1374
+ try : #linux
1375
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1376
+ topObs .tk .call ('wm' ,'iconphoto' ,topObs ._w ,img )
1377
+ except : pass
1378
+ topObs .configure (background = colors ['window' ])
1336
1379
topObs .resizable (False ,False )
1337
1380
1338
1381
obsNameVar = tk .StringVar (topObs )
@@ -1381,13 +1424,18 @@ def saveLims():
1381
1424
topLims .destroy ()
1382
1425
topSite .lift ()
1383
1426
1384
- topLims = tk .Tk ()
1427
+ topLims = tk .Toplevel ()
1385
1428
topLims .lift ()
1386
1429
topLims .geometry ('400x150' )
1387
1430
topLims .title ('Limits' )
1388
1431
topLims .resizable (False ,False )
1389
1432
try : topLims .iconbitmap ('ObsPlanner.ico' ) #win
1390
- except : pass
1433
+ except :
1434
+ try : #linux
1435
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1436
+ topLims .tk .call ('wm' ,'iconphoto' ,topLims ._w ,img )
1437
+ except : pass
1438
+ topLims .configure (background = colors ['window' ])
1391
1439
1392
1440
minAltVar = tk .DoubleVar (topLims )
1393
1441
maxAltVar = tk .DoubleVar (topLims )
@@ -1487,12 +1535,17 @@ def saveSite():
1487
1535
topSite .destroy ()
1488
1536
top .lift ()
1489
1537
1490
- topSite = tk .Tk ()
1538
+ topSite = tk .Toplevel ()
1491
1539
topSite .lift ()
1492
1540
topSite .geometry ('230x200' )
1493
1541
topSite .title ('Site' )
1494
1542
try : topSite .iconbitmap ('ObsPlanner.ico' ) #win
1495
- except : pass
1543
+ except :
1544
+ try : #linux
1545
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1546
+ topSite .tk .call ('wm' ,'iconphoto' ,topSite ._w ,img )
1547
+ except : pass
1548
+ topSite .configure (background = colors ['window' ])
1496
1549
topSite .resizable (False ,False )
1497
1550
1498
1551
siteNameVar = tk .StringVar (topSite )
@@ -1598,12 +1651,17 @@ def saveTel():
1598
1651
topTel .destroy ()
1599
1652
top .lift ()
1600
1653
1601
- topTel = tk .Tk ()
1654
+ topTel = tk .Toplevel ()
1602
1655
topTel .lift ()
1603
1656
topTel .geometry ('400x80' )
1604
1657
topTel .title ('Telescope' )
1605
1658
try : topTel .iconbitmap ('ObsPlanner.ico' ) #win
1606
- except : pass
1659
+ except :
1660
+ try : #linux
1661
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1662
+ topTel .tk .call ('wm' ,'iconphoto' ,topTel ._w ,img )
1663
+ except : pass
1664
+ topTel .configure (background = colors ['window' ])
1607
1665
topTel .resizable (False ,False )
1608
1666
1609
1667
telNameVar = tk .StringVar (topTel )
@@ -1681,12 +1739,17 @@ def saveSet():
1681
1739
top .destroy ()
1682
1740
root .lift ()
1683
1741
1684
- top = tk .Tk ()
1742
+ top = tk .Toplevel ()
1685
1743
top .lift ()
1686
1744
top .geometry ('530x200' )
1687
1745
top .title ('Settings' )
1688
1746
try : top .iconbitmap ('ObsPlanner.ico' ) #win
1689
- except : pass
1747
+ except :
1748
+ try : #linux
1749
+ img = tk .Image ('photo' ,file = 'ObsPlanner.png' )
1750
+ top .tk .call ('wm' ,'iconphoto' ,top ._w ,img )
1751
+ except : pass
1752
+ top .configure (background = colors ['window' ])
1690
1753
top .resizable (False ,False )
1691
1754
1692
1755
settings1 = copy .deepcopy (settings )
@@ -2383,7 +2446,6 @@ def obsselect(evt):
2383
2446
Text1 .configure (width = 256 )
2384
2447
Text1 .configure (wrap = tk .WORD )
2385
2448
2386
- #TODO focus color?
2387
2449
Button3_2 = tk .Button (Labelframe0 )
2388
2450
Button3_2 .place (relx = 0.05 ,rely = 0.95 ,height = 24 ,width = 47 )
2389
2451
Button3_2 .configure (command = AddObj )
@@ -2525,19 +2587,20 @@ def obsselect(evt):
2525
2587
canvas1 = FigureCanvasTkAgg (figObj ,frame1 )
2526
2588
canvas1 .get_tk_widget ().pack (side = 'top' ,fill = 'both' ,expand = 1 )
2527
2589
2528
- #TODO focus color?, disabled color?
2529
2590
#menu
2530
2591
Popupmenu1 = tk .Menu (root ,tearoff = 0 )
2531
2592
Popupmenu1 .configure (background = colors ['window' ])
2532
2593
Popupmenu1 .configure (fg = colors ['text' ])
2594
+ if colors ['text' ]== 'red' :
2595
+ Popupmenu1 .configure (activebackground = colors ['select_bg' ])
2596
+ Popupmenu1 .configure (activeforeground = colors ['select_text' ])
2533
2597
2534
2598
fileM = tk .Menu (Popupmenu1 ,tearoff = 0 )
2535
2599
fileM .configure (background = colors ['window' ])
2536
2600
fileM .configure (fg = colors ['text' ])
2537
2601
if colors ['text' ]== 'red' :
2538
2602
fileM .configure (activebackground = colors ['select_bg' ])
2539
2603
fileM .configure (activeforeground = colors ['select_text' ])
2540
- #fileM.configure(inactiveselectbackground=colors['select_bg'])
2541
2604
Popupmenu1 .add_cascade (menu = fileM ,label = 'File' )
2542
2605
fileM .add_command (command = NewFile ,label = 'New' ,accelerator = 'Ctrl+N' )
2543
2606
root .bind ('<Control-n>' ,NewFile )
@@ -2553,10 +2616,10 @@ def obsselect(evt):
2553
2616
import_export = tk .Menu (Popupmenu1 ,tearoff = 0 )
2554
2617
import_export .configure (background = colors ['window' ])
2555
2618
import_export .configure (fg = colors ['text' ])
2619
+ import_export .configure (disabledforeground = colors ['text_dis' ])
2556
2620
if colors ['text' ]== 'red' :
2557
2621
import_export .configure (activebackground = colors ['select_bg' ])
2558
2622
import_export .configure (activeforeground = colors ['select_text' ])
2559
- #import_export.configure(inactiveselectbackground=colors['select_bg'])
2560
2623
Popupmenu1 .add_cascade (menu = import_export ,label = 'Import/Export' )
2561
2624
2562
2625
importMenu = tk .Menu (import_export ,tearoff = 0 )
@@ -2565,7 +2628,6 @@ def obsselect(evt):
2565
2628
if colors ['text' ]== 'red' :
2566
2629
importMenu .configure (activebackground = colors ['select_bg' ])
2567
2630
importMenu .configure (activeforeground = colors ['select_text' ])
2568
- #importMenu.configure(inactiveselectbackground=colors['select_bg'])
2569
2631
import_export .add_cascade (menu = importMenu ,label = 'Import Objects' )
2570
2632
importMenu .add_command (label = 'from APT' ,command = aptI )
2571
2633
importMenu .add_command (label = 'from AstroPlanner' ,command = plannerI )
@@ -2582,7 +2644,6 @@ def obsselect(evt):
2582
2644
if colors ['text' ]== 'red' :
2583
2645
exportObj .configure (activebackground = colors ['select_bg' ])
2584
2646
exportObj .configure (activeforeground = colors ['select_text' ])
2585
- #exportObj.configure(inactiveselectbackground=colors['select_bg'])
2586
2647
exportObj .configure (disabledforeground = colors ['text_dis' ])
2587
2648
import_export .add_cascade (menu = exportObj ,label = 'Export Selected Objects' ,state = tk .DISABLED )
2588
2649
exportObj .add_command (label = 'to APT' ,command = aptE )
@@ -2598,7 +2659,6 @@ def obsselect(evt):
2598
2659
if colors ['text' ]== 'red' :
2599
2660
exportObs .configure (activebackground = colors ['select_bg' ])
2600
2661
exportObs .configure (activeforeground = colors ['select_text' ])
2601
- #exportObs.configure(inactiveselectbackground=colors['select_bg'])
2602
2662
exportObs .configure (disabledforeground = colors ['text_dis' ])
2603
2663
import_export .add_cascade (menu = exportObs ,label = 'Export Observations of Object' ,state = tk .DISABLED )
2604
2664
exportObs .add_command (label = 'to Excel' ,command = excelObsE )
@@ -2610,7 +2670,6 @@ def obsselect(evt):
2610
2670
if colors ['text' ]== 'red' :
2611
2671
exportObsAll .configure (activebackground = colors ['select_bg' ])
2612
2672
exportObsAll .configure (activeforeground = colors ['select_text' ])
2613
- #exportObsAll.configure(inactiveselectbackground=colors['select_bg'])
2614
2673
exportObsAll .configure (disabledforeground = colors ['text_dis' ])
2615
2674
import_export .add_cascade (menu = exportObsAll ,label = 'Export All Observations' ,state = tk .DISABLED )
2616
2675
exportObsAll .add_command (label = 'to Excel' ,command = excelObsAllE )
0 commit comments