diff --git a/app.py b/app.py
index d341e0f..cea98bc 100644
--- a/app.py
+++ b/app.py
@@ -5,7 +5,7 @@ from mods.db import db, Patient, Catalog, List
from mods.catalogs import create_new_catalog_win, build_catalog_row, catalog_sort_func, catalog_filter_func
from mods.patients import build_patient_row, patient_sort_func, patient_filter_func_factory, create_new_patient_win, create_open_patient_win
from mods.patients import search_patients
-from mods.receptions import create_new_reception_win, redraw_reception_list, create_reception_list_settings_win
+from mods.receptions import create_new_reception_win, redraw_reception_list, create_reception_list_settings_win, create_open_reception_win
from mods.lists import create_open_list_win, build_list_row
from mods.root import builder
from mods.utils import enable_widget, disable_widget, ConditionalFilter
@@ -36,6 +36,9 @@ class MainWinHandler:
def show_new_reception_win(self, button):
new_reception_win = create_new_reception_win()
new_reception_win.show_all()
+ def show_open_reception_win(self, button):
+ open_reception_win = create_open_reception_win()
+ open_reception_win.show_all()
def show_new_patient_win(self, button):
new_patient_win = create_new_patient_win()
new_patient_win.show_all()
@@ -56,19 +59,21 @@ class MainWinHandler:
rl = builder.get_object('reception_list')
new_button = builder.get_object('new_reception_button')
edit_button = builder.get_object('edit_reception_button')
+ remove_button = builder.get_object('remove_reception_button')
row = rl.get_selected_row()
if not row:
- return
+ return True
if row.props.scheduled:
- enable_widget([edit_button])
+ enable_widget([edit_button, remove_button])
disable_widget([new_button])
else:
enable_widget([new_button])
- disable_widget([edit_button])
+ disable_widget([edit_button, remove_button])
def reception_list_unselected(self, *a):
new_button = builder.get_object('new_reception_button')
edit_button = builder.get_object('edit_reception_button')
- disable_widget([new_button, edit_button])
+ remove_button = builder.get_object('remove_reception_button')
+ disable_widget([new_button, edit_button, remove_button])
def patient_list_selected(self, *a):
button = builder.get_object('patient_open_button')
enable_widget([button])
diff --git a/mods/files.py b/mods/files.py
index 437d9a4..d906a0c 100644
--- a/mods/files.py
+++ b/mods/files.py
@@ -34,3 +34,4 @@ new_reception_win_file = os.path.join(ui_dir, 'new_reception_win.glade')
reception_list_settings_win_file = os.path.join(ui_dir, 'reception_list_settings.glade')
new_catalog_win_file = os.path.join(ui_dir, 'new_catalog_win.glade')
choose_patient_win_file = os.path.join(ui_dir, 'choose_patient_win.glade')
+open_reception_win_file = os.path.join(ui_dir, 'open_reception_win.glade')
diff --git a/mods/lists.py b/mods/lists.py
index d23db63..38dc5a4 100644
--- a/mods/lists.py
+++ b/mods/lists.py
@@ -11,7 +11,8 @@ lists_map = {
'diagnoz': 'Диагноз',
'anamnez': 'Анамнез',
'observ': 'Осмотр',
- 'druggs': 'Медикаменты'
+ 'medicines': 'Медикаменты',
+ 'procedures': 'Процедуры'
}
for s_id in lists_map:
diff --git a/mods/patients.py b/mods/patients.py
index 6ef1169..28fe2f4 100644
--- a/mods/patients.py
+++ b/mods/patients.py
@@ -43,6 +43,9 @@ def search_patients(q):
def get_all_patients():
with db.atomic():
return Patient.select()
+def get_patient(patient_id):
+ with db.atomic():
+ return Patient.get_by_id(patient_id)
class PatientRow(Gtk.ListBoxRow):
@GObject.Property
diff --git a/mods/receptions.py b/mods/receptions.py
index 4ec49f3..84f8afa 100644
--- a/mods/receptions.py
+++ b/mods/receptions.py
@@ -2,7 +2,7 @@ import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject, Gdk
from mods.db import db, Reception, Patient
-from mods.files import new_reception_win_file, reception_row_ui_str, reception_list_settings_win_file
+from mods.files import new_reception_win_file, reception_row_ui_str, reception_list_settings_win_file, open_reception_win_file
from mods.settings import s_get_reception_list, s_set_reception_list
from mods.root import builder
from datetime import datetime, timedelta
@@ -47,6 +47,10 @@ class NewReceptionPatientLabel(Gtk.Label):
def db_id_setter(self, value):
self._db_id = value
+def get_reception(reception_id):
+ with db.atomic():
+ return Reception.get_by_id(reception_id)
+
def build_reception_row(reception_datetime):
b = Gtk.Builder()
b.add_from_string(reception_row_ui_str)
@@ -75,6 +79,23 @@ def build_reception_row(reception_datetime):
row.add(box)
return row
+def create_open_reception_win():
+ b = Gtk.Builder()
+ reception_list = builder.get_object('reception_list')
+ reception_row = reception_list.get_selected_row()
+ reception = get_reception(reception_row.props.db_id)
+ class OpenReceptionWinHandler:
+ pass
+ b.add_from_file(open_reception_win_file)
+ b.connect_signals(OpenReceptionWinHandler())
+ #
+ patient_fio = b.get_object('patient_fio')
+ patient_fio.set_markup(f'{" ".join([reception.patient.last_name, reception.patient.first_name, reception.patient.middle_name])}')
+ reception_dt = b.get_object('reception_datetime')
+ reception_dt.set_markup(f'{reception_row.props.datetime.strftime("%d.%m.%Y - %H:%M")}')
+ #
+ w = b.get_object('open_reception_window')
+ return w
def create_new_reception_win():
b = Gtk.Builder()
reception_list = builder.get_object('reception_list')
@@ -88,7 +109,7 @@ def create_new_reception_win():
pat_label = patient_cont.get_children()[0]
if pat_label.props.db_id < 0:
return
- rec = add_reception(pat_label.props.db_id, row.props.datetime)
+ _ = add_reception(pat_label.props.db_id, row.props.datetime)
w.destroy()
redraw_reception_list(row.props.datetime)
b.add_from_file(new_reception_win_file)
@@ -103,7 +124,7 @@ def create_new_reception_win():
patient_cont.reorder_child(patient_label, 0)
w = b.get_object('new_reception_window')
dt_label = b.get_object('datetime')
- dt_label.set_text(row.props.datetime.strftime('%m.%d.%Y - %H:%M'))
+ dt_label.set_text(row.props.datetime.strftime('%d.%m.%Y - %H:%M'))
return w
def create_reception_list_settings_win():
b = Gtk.Builder()
diff --git a/res/ui/choose_list_win.glade b/res/ui/choose_list_win.glade
new file mode 100644
index 0000000..24d8dcf
--- /dev/null
+++ b/res/ui/choose_list_win.glade
@@ -0,0 +1,169 @@
+
+
+
+
+
+
diff --git a/res/ui/main_win.glade b/res/ui/main_win.glade
index 86536e8..13e80bd 100644
--- a/res/ui/main_win.glade
+++ b/res/ui/main_win.glade
@@ -69,9 +69,24 @@
False
False
Изменить
- Изменить
+ Открыть
True
- gtk-edit
+ gtk-open
+
+
+
+ False
+ True
+
+
+
+
+ True
+ False
+ False
+ Удалить
+ True
+ gtk-no
False
diff --git a/res/ui/open_reception_win.glade b/res/ui/open_reception_win.glade
index 431857a..1a48108 100644
--- a/res/ui/open_reception_win.glade
+++ b/res/ui/open_reception_win.glade
@@ -64,7 +64,6 @@
False
5
5
- 5
5
12
@@ -104,7 +103,6 @@
False
5
5
- 5
5
12
@@ -222,6 +220,26 @@
1
+
+
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-delete
+ 3
+
+
+
+
+ False
+ True
+ 2
+
+
True
@@ -230,7 +248,7 @@
True
True
- 2
+ 3
@@ -340,6 +358,26 @@
1
+
+
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-delete
+ 3
+
+
+
+
+ False
+ True
+ 2
+
+
True
@@ -348,7 +386,7 @@
True
True
- 2
+ 3
@@ -469,6 +507,26 @@
1
+
+
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-delete
+ 3
+
+
+
+
+ False
+ True
+ 2
+
+
True
@@ -477,7 +535,7 @@
True
True
- 2
+ 3
@@ -587,6 +645,26 @@
1
+
+
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-delete
+ 3
+
+
+
+
+ False
+ True
+ 2
+
+
True
@@ -595,7 +673,7 @@
True
True
- 2
+ 3
@@ -716,6 +794,26 @@
1
+
+
+ True
+ True
+ True
+
+
+ True
+ False
+ gtk-delete
+ 3
+
+
+
+
+ False
+ True
+ 2
+
+
True
@@ -724,7 +822,7 @@
True
True
- 2
+ 3