-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmyTheme.py
More file actions
162 lines (123 loc) · 3.9 KB
/
Copy pathmyTheme.py
File metadata and controls
162 lines (123 loc) · 3.9 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
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
#!/usr/bin/env python3
################################
#### myTheme.py ####
#### Version 20260113 ####
################################
import os
import tkinter as tk
from tkinter import font as tkFont
from cairosvg import svg2png
# App globals
global baseDir
baseDir = os.path.abspath( os.path.dirname(__file__) )
# logo
global logoPathStr
logoPathStr = os.path.join( baseDir, "img", "linux-big.png" )
# print(f"myTheme | logoPathStr exists? { os.path.isfile( logoPathStr ) } ")
global icoPath
icoPath = os.path.join( baseDir, "img", "linux-big.png" )
# print(f"myTheme | icoPath exists? { os.path.isfile( icoPath ) } ")
global inAppSvgPaths
inAppSvgPaths = os.path.join( baseDir, "fontawesome7.0.0/svgs/solid/" )
# print(f"myTheme | inAppSvgPaths exists? { os.path.isdir( inAppSvgPaths ) } ")
global inAppIconsPath
inAppIconsPath = os.path.join( baseDir, "img", "inAppIcons" )
# print(f"myTheme | inAppIconsPath exists? { os.path.isdir( inAppIconsPath ) } ")
#------------------------------------------------------------------------------
def logoPath():
return logoPathStr
#------------------------------------------------------------------------------
def convertToPNG( svgName ):
pngName = os.path.join( inAppIconsPath, f"{svgName}.png" )
if os.path.exists( pngName ):
pass
# print(f"myTheme | convertToPNG --svgName: { svgName } = { srcName }\nexists already as\n{ pngName }" )
else:
if os.path.isdir(inAppSvgPaths):
srcName = os.path.join( inAppSvgPaths, f"{svgName}.svg" )
if os.path.exists( srcName ):
svg_code = open( srcName, 'rt').read()
svg2png( bytestring = svg_code, write_to = pngName )
print(f"Created new icon file for {svgName} .Should only happen in BETA !!")
else:
# The name of this icon isn't found
pngName = icoPath
else:
# Can't make a .png icon. returning linux default
pngName = icoPath
return pngName
#------------------------------------------------------------------------------
def iconPath( iconName="pan-down-symbolic"):
retValPath = convertToPNG( iconName )
# print(f"returning iconPath: { retValPath }")
if os.path.isfile(retValPath):
return retValPath
else:
return os.path.join( inAppIconsPath, "arrow-rotate-left.png" )
# Create fonts
#------------------------------------------------------------------------------
def provideFont( size = "N" ):
mySmallFont = tkFont.Font( family="Arial", size=10, weight=tkFont.NORMAL )
myNormalFont= tkFont.Font( family="Arial", size=12, weight=tkFont.NORMAL )
myBigFont = tkFont.Font( family="Arial", size=14, weight=tkFont.NORMAL )
myHugeFont = tkFont.Font( family="Arial", size=20, weight=tkFont.NORMAL )
if size == "S":
return mySmallFont
elif size == "N":
return myNormalFont
elif size == "B":
return myBigFont
elif size == "H":
return myHugeFont
elif type(size) == type(1):
myCustomFont = tkFont.Font( family="Arial", size=size, weight=tkFont.NORMAL )
# print(f"provideFont {size} = {str(myCustomFont)}")
return myCustomFont
else:
print(f"provideFont unrecognized size = {size} . returning myNormalFont")
return myNormalFont
##################################################
# TK:
# Buttons
myBttnBG = "#0032B4"
myBttnFG = "#B4FF7D"
# Labels
myLblBG = "#0032B4" # dark blue
myLblFG = "#B4FF7D" # light green
# ListBoxes/choices
myLbxBG = "#0032B4"
myLbxFG = "#B4FF7D"
# Absolutes
myWhite = "#FFFFFF"
myBlack = "#000000"
myTrue = "#AAFF55"
myFalse = "#FF3232"
# Oranges
myLOrange = "#FFCC80"
myNOrange = "#FFB546"
myDOrange = "#FF9900"
# Blues
myLBlue = "#96C8FF"
myNBlue = "#329BFF"
myDBlue = "#007DFF"
myDDBlue = "#1F1F7A"
# Greens
myLGreen= "#00FF7D"
myNGreen= "#00D27D"
myDGreen= "#00AA7D"
# Greys
myLGrey = "#E0E0E0"
myNGrey = "#707070"
myDGrey = "#383838"
# Yellows
myLYellow = "#FFFF28"
myNYellow = "#FFFF55"
myDYellow = "#FFFF7D"
# Reds
myDRed = "#FA3232"
myNRed = "#FA4B64"
myLRed = "#FA9696"
# Purples
myLPurple = "#FF00FF"
myNPurple = "#BB00BB"
myDPurple = "#990099"