В настройках графика приёмов форматируем числа

This commit is contained in:
Бородин Роман 2019-12-13 15:17:21 +03:00
parent 4359ab54db
commit ffb62cffd5
2 changed files with 13 additions and 2 deletions

View File

@ -63,9 +63,10 @@ def build_reception_row(reception_datetime):
row.props.db_id = reception.id
reception_cont = b.get_object('reception_cont')
reception_cont.props.border_width = 2
reception_cont.override_background_color(Gtk.StateFlags(0), Gdk.RGBA(red=0.5, green=0.7, blue=0.5, alpha=1.0))
reception_cont.override_background_color(Gtk.StateFlags(0), Gdk.RGBA(red=0.6, green=0.8, blue=0.6, alpha=1.0))
reception_patient = Gtk.Label()
reception_patient.set_text(' '.join([reception.patient.last_name, reception.patient.first_name, reception.patient.middle_name]))
reception_patient.set_markup(f'<span size="xx-large">{" ".join([reception.patient.last_name, reception.patient.first_name, reception.patient.middle_name])}</span>')
#reception_patient.set_text(' '.join([reception.patient.last_name, reception.patient.first_name, reception.patient.middle_name]))
reception_cont.add(reception_patient)
else:
row.props.scheduled = False
@ -107,6 +108,11 @@ def create_new_reception_win():
def create_reception_list_settings_win():
b = Gtk.Builder()
class ReceptionListSettingsHandler:
def leading_zeroes(self, entry):
adj = entry.get_adjustment()
val = int(adj.get_value())
entry.set_text(f'{val:02d}')
return True
def save_settings(self, *a):
start_hour = int(b.get_object('start_hour').get_value())
start_minute = int(b.get_object('start_minute').get_value())

View File

@ -110,6 +110,7 @@
<property name="input_purpose">number</property>
<property name="adjustment">adj_start_hour</property>
<property name="numeric">True</property>
<signal name="output" handler="leading_zeroes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -143,6 +144,7 @@
<property name="input_purpose">number</property>
<property name="adjustment">adj_start_minute</property>
<property name="numeric">True</property>
<signal name="output" handler="leading_zeroes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -198,6 +200,7 @@
<property name="input_purpose">number</property>
<property name="adjustment">adj_end_hour</property>
<property name="numeric">True</property>
<signal name="output" handler="leading_zeroes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -231,6 +234,7 @@
<property name="input_purpose">number</property>
<property name="adjustment">adj_end_minute</property>
<property name="numeric">True</property>
<signal name="output" handler="leading_zeroes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
@ -286,6 +290,7 @@
<property name="input_purpose">number</property>
<property name="adjustment">adj_interval</property>
<property name="numeric">True</property>
<signal name="output" handler="leading_zeroes" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>