Skip to content

Commit

Permalink
adds new font graph font options Comic Neue (a redesigned Comic Sans)…
Browse files Browse the repository at this point in the history
… and xkcd Script (a more complete version of Humor)
  • Loading branch information
MAKOMO committed Nov 11, 2023
1 parent e4f53a1 commit bad297c
Show file tree
Hide file tree
Showing 8 changed files with 37 additions and 9 deletions.
7 changes: 4 additions & 3 deletions src/artisanlib/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,8 @@ def __init__(self, parent:QWidget, dpi:int, locale:str, aw:'ApplicationWindow')
#default palette of colors
self.locale_str:str = locale
self.alpha:Dict[str,float] = {'analysismask':0.4,'statsanalysisbkgnd':1.0,'legendbg':0.4}
self.palette:Dict[str,str] = {'background':'#ffffff','grid':'#e5e5e5','ylabel':'#808080','xlabel':'#808080','title':'#0c6aa6', 'title_focus':'#cc0f50',
self.palette:Dict[str,str] = {'background':'#ffffff','grid':'#e5e5e5','ylabel':'#808080','xlabel':'#808080','title':'#0c6aa6',
'title_focus':'#cc0f50', 'title_hidden':'#808080',
'rect1':'#e5e5e5','rect2':'#b2b2b2','rect3':'#e5e5e5','rect4':'#bde0ee','rect5':'#d3d3d3',
'et':'#cc0f50','bt':'#0a5c90','xt':'#404040','yt':'#404040','deltaet':'#cc0f50',
'deltabt':'#0a5c90','markers':'#000000','text':'#000000','watermarks':'#ffff00','timeguide':'#0a5c90',
Expand Down Expand Up @@ -7492,7 +7493,7 @@ def setProfileBackgroundTitle(self,backgroundtitle):
horizontalalignment='right',verticalalignment='top',
fontsize='x-small',
x=suptitleX,y=1,
color=(self.palette['title_focus'] if (self.backgroundprofile is not None and self.backgroundPlaybackEvents) else self.palette['title']))
color=(self.palette['title_hidden'] if not self.background else (self.palette['title_focus'] if (self.backgroundprofile is not None and self.backgroundPlaybackEvents) else self.palette['title'])))
try:
self.l_subtitle.set_in_layout(False) # remove title from tight_layout calculation
except Exception: # pylint: disable=broad-except # set_in_layout not available in mpl<3.x
Expand All @@ -7519,7 +7520,7 @@ def setProfileTitle(self,title:str,updatebackground:bool = False) -> None:
elif bnr == 0 and title != '' and title != self.title != QApplication.translate('Scope Title', 'Roaster Scope') and bprefix != '':
title = f'{bprefix} {title}'

if self.graphfont in {1, 9}: # if selected font is Humor or Dijkstra we translate the unicode title into pure ascii
if self.graphfont in {1,9}: # if selected font is Humor or Dijkstra we translate the unicode title into pure ascii
title = self.__to_ascii(title)

self.title_text = self.aw.arabicReshape(title.strip())
Expand Down
1 change: 1 addition & 0 deletions src/artisanlib/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -6066,6 +6066,7 @@ def ARDUINOTC4temperature(self, chan:Optional[str] = None) -> Tuple[float, float
#OK. NOW SET FILTER
self.SP.reset_input_buffer()
self.SP.reset_output_buffer()
# filt = ','.join(map(str,self.aw.ser.ArduinoFILT))
filt = ','.join([str(f) for f in self.aw.ser.ArduinoFILT])
command = 'FILT;' + filt + '\n' #Set filters
self.SP.write(str2cmd(command))
Expand Down
4 changes: 3 additions & 1 deletion src/artisanlib/curves.py
Original file line number Diff line number Diff line change
Expand Up @@ -690,7 +690,9 @@ def __init__(self, parent:QWidget, aw:'ApplicationWindow', activeTab:int = 0) ->
'Source Han Sans HK',
'Source Han Sans KR',
'Source Han Sans JP',
'Dijkstra'])
'Dijkstra',
'xkcd Script',
'Comic Neue'])
self.GraphFont.setCurrentIndex(self.aw.qmc.graphfont)
self.GraphFont.currentIndexChanged.connect(self.changeGraphFont)
graphLayout = QHBoxLayout()
Expand Down
26 changes: 24 additions & 2 deletions src/artisanlib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -6865,10 +6865,30 @@ def setFonts(self, redraw=True):
rcParams['font.family'] = ['Dijkstra']
rcParams['axes.unicode_minus'] = False
self.set_mpl_fontproperties(getResourcePath() + 'dijkstra.ttf')
elif self.qmc.graphfont == 10:
# font xkcd Script selected
# https://github.com/ipython/xkcd-font/
rcParams['axes.unicode_minus'] = False
rcParams['font.size'] = 14.0
if platform.system() == 'Linux':
rcParams['font.family'] = ['xkcd Script']
else:
rcParams['font.family'] = ['xkcd Script', 'Comic Sans MS']
self.set_mpl_fontproperties(getResourcePath() + 'xkcd-script.ttf')
elif self.qmc.graphfont == 11:
# font Comic Neue selected
# http://comicneue.com/
rcParams['axes.unicode_minus'] = False
rcParams['font.size'] = 12.0
if platform.system() == 'Linux':
rcParams['font.family'] = ['Comic Neue']
else:
rcParams['font.family'] = ['Comic Neue', 'Comic Sans MS']
self.set_mpl_fontproperties(getResourcePath() + 'ComicNeue-Regular.ttf')
elif self.qmc.graphfont == 1 or platform.system() == 'Linux': # no Comic on Linux!
# font Humor selected
rcParams['axes.unicode_minus'] = False
rcParams['font.size'] = 16.0
rcParams['font.size'] = 15.0
if platform.system() == 'Linux':
rcParams['font.family'] = ['Humor Sans']
else:
Expand Down Expand Up @@ -10833,8 +10853,10 @@ def updatePlaybackIndicator(self):
if self.qmc.l_subtitle is not None and self.qmc.ax is not None:
if self.qmc.backgroundprofile is not None and self.qmc.backgroundPlaybackEvents:
self.qmc.l_subtitle.set_color(self.qmc.palette['title_focus'])
else:
elif self.qmc.background:
self.qmc.l_subtitle.set_color(self.qmc.palette['title'])
else:
self.qmc.l_subtitle.set_color(self.qmc.palette['title_hidden'])
self.qmc.ax.draw_artist(self.qmc.l_subtitle)
if self.qmc.ax.figure is not None:
self.qmc.ax.figure.canvas.blit()
Expand Down
2 changes: 1 addition & 1 deletion src/artisanlib/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ class ProfileData(TypedDict, total=False):
plus_sync_record_hash: str


class ExtraDeviceSettings(TypedDict): #, total=False):
class ExtraDeviceSettings(TypedDict):
extradevices : List[int]
extradevicecolor1 : List[str]
extradevicecolor2 : List[str]
Expand Down
Binary file added src/includes/ComicNeue-Regular.ttf
Binary file not shown.
Binary file added src/includes/xkcd-script.ttf
Binary file not shown.
6 changes: 4 additions & 2 deletions src/setup-install3-pi.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ Section Uninstall
RMDir /r "$INSTDIR\yaml"
RMDir /r "$INSTDIR\yoctopuce"
RMDir /r "$INSTDIR\zope"

RMDir /r "$INSTDIR\_internal"

!insertmacro Rmdir_Wildcard "$INSTDIR\PyQt*" ${__LINE__}
Expand Down Expand Up @@ -414,7 +414,9 @@ Section Uninstall
Delete "$INSTDIR\artisanWheel.ico"
Delete "$INSTDIR\artisanSettings.ico"
Delete "$INSTDIR\Humor-Sans.ttf"
Delete "$INSTDIR\dijkstra.ttf"
Delete "$INSTDIR\dijkstra.ttf"
Delete "$INSTDIR\xkcd-script.ttf"
Delete "$INSTDIR\ComicNeue-Regular.ttf"
Delete "$INSTDIR\WenQuanYiZenHei-01.ttf"
Delete "$INSTDIR\WenQuanYiZenHeiMonoMedium.ttf"
Delete "$INSTDIR\SourceHanSansCN-Regular.otf"
Expand Down

0 comments on commit bad297c

Please sign in to comment.