Skip to content

Commit 17f86eb

Browse files
committed
gmoccapy: add font filter for popup messages font chooser
1 parent e9ed01a commit 17f86eb

2 files changed

Lines changed: 50 additions & 3 deletions

File tree

src/emc/usr_intf/gmoccapy/gmoccapy.glade

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,7 +4512,7 @@ clicking on the DRO</property>
45124512
<property name="hexpand">False</property>
45134513
<property name="label-xalign">0.5</property>
45144514
<child>
4515-
<!-- n-columns=2 n-rows=7 -->
4515+
<!-- n-columns=2 n-rows=8 -->
45164516
<object class="GtkGrid" id="grid_messages_style">
45174517
<property name="visible">True</property>
45184518
<property name="can-focus">False</property>
@@ -4691,7 +4691,7 @@ will be in a frame.</property>
46914691
</object>
46924692
<packing>
46934693
<property name="left-attach">0</property>
4694-
<property name="top-attach">5</property>
4694+
<property name="top-attach">6</property>
46954695
<property name="width">2</property>
46964696
</packing>
46974697
</child>
@@ -4708,10 +4708,44 @@ to test your settings.</property>
47084708
</object>
47094709
<packing>
47104710
<property name="left-attach">0</property>
4711-
<property name="top-attach">6</property>
4711+
<property name="top-attach">7</property>
47124712
<property name="width">2</property>
47134713
</packing>
47144714
</child>
4715+
<child>
4716+
<object class="GtkLabel" id="lbl_messages_font_filter">
4717+
<property name="visible">True</property>
4718+
<property name="can-focus">False</property>
4719+
<property name="margin-start">3</property>
4720+
<property name="hexpand">True</property>
4721+
<property name="label" translatable="yes">Font filter</property>
4722+
<property name="xalign">0</property>
4723+
</object>
4724+
<packing>
4725+
<property name="left-attach">0</property>
4726+
<property name="top-attach">5</property>
4727+
</packing>
4728+
</child>
4729+
<child>
4730+
<object class="GtkComboBoxText" id="cmb_messages_font_face">
4731+
<property name="visible">True</property>
4732+
<property name="can-focus">False</property>
4733+
<property name="active">0</property>
4734+
<items>
4735+
<item id="0">All</item>
4736+
<item id="1">Regular</item>
4737+
<item id="2">Bold</item>
4738+
<item id="3">Medium</item>
4739+
<item id="4">Book</item>
4740+
<item id="5">Italic</item>
4741+
</items>
4742+
<signal name="changed" handler="on_cmb_messages_font_face_changed" swapped="no"/>
4743+
</object>
4744+
<packing>
4745+
<property name="left-attach">1</property>
4746+
<property name="top-attach">5</property>
4747+
</packing>
4748+
</child>
47154749
</object>
47164750
</child>
47174751
<child type="label">

src/emc/usr_intf/gmoccapy/gmoccapy.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2167,9 +2167,19 @@ def _gcodeview_font_filter(self, family, face, monospace, regular):
21672167
reg = not regular or face.get_face_name()=="Regular" or face.get_face_name()=="Medium" or face.get_face_name()=="Book"
21682168
return mono and reg
21692169

2170+
# Filter function for messages font selection
2171+
def _messages_font_filter(self, family, face, wanted_face):
2172+
if wanted_face == "All":
2173+
return True
2174+
else:
2175+
return face.get_face_name() == wanted_face
2176+
21702177
def _update_gcodeview_font_filter(self):
21712178
self.widgets.fontbutton_gcodeview.set_filter_func(self._gcodeview_font_filter, self.widgets.chk_font_monospace.get_active(), self.widgets.chk_font_regular.get_active())
21722179

2180+
def _update_messages_font_filter(self):
2181+
self.widgets.fontbutton_popup.set_filter_func(self._messages_font_filter, self.widgets.cmb_messages_font_face.get_active_text())
2182+
21732183

21742184
def _init_audio(self):
21752185
# try to add ability for audio feedback to user.
@@ -4056,6 +4066,9 @@ def on_chk_use_frames_toggled(self, widget, data=None):
40564066
def on_fontbutton_popup_font_set(self, font):
40574067
self.prefs.putpref("message_font", self.widgets.fontbutton_popup.get_font())
40584068
self._init_notification()
4069+
4070+
def on_cmb_messages_font_face_changed(self, widget):
4071+
self._update_messages_font_filter()
40594072

40604073
def on_fontbutton_gcodeview_font_set(self, widget):
40614074
self.widgets.gcode_view.modify_font(widget.get_font_desc())

0 commit comments

Comments
 (0)