Skip to content
This repository
Browse code

Merge branch 'master' of github.com:shroff/pharc

  • Loading branch information...
commit 102afdca30141d1a53500c25606b0c891050dce0 2 parents e2d6b31 + 2a8407b
James Cline jcline authored

Showing 2 changed files with 31 additions and 10 deletions. Show diff stats Hide diff stats

  1. +1 1  src/gui/patienteditpage.py
  2. +30 9 src/gui/patientnamerow.py
2  src/gui/patienteditpage.py
@@ -61,5 +61,5 @@ def cancelChanges(self):
61 61
62 62 def setPatient(self, patient):
63 63 self.patient = patient
64   - self.nameRow.setName(self.patient.nameFirst + " " + self.patient.nameLast)
  64 + self.nameRow.setPatient(self.patient)
65 65 self.detailTable.setPatient(self.patient)
39 src/gui/patientnamerow.py
@@ -18,6 +18,9 @@
18 18 from PyQt4.QtGui import *
19 19 from PyQt4.QtCore import *
20 20
  21 +import database.fs
  22 +from logic.datamanager import DataManager
  23 +
21 24 class PatientNameRow(QWidget):
22 25 def __init__(self):
23 26 super(PatientNameRow, self).__init__()
@@ -26,14 +29,18 @@ def __init__(self):
26 29 self.changing = False
27 30
28 31 def initUI(self):
29   - self.changeNameField = ChangeNameField(self)
  32 + self.changeFirstName = ChangeNameField(self)
  33 + self.changeLastName = ChangeNameField(self)
  34 + self.changeLastName.setVisible(False)
  35 +
30 36 self.editButton = QPushButton('Edit')
31 37 self.cancelButton = QPushButton('Cancel')
32 38 self.cancelButton.setVisible(False)
33 39
34 40 hbox = QHBoxLayout()
35 41 hbox.addWidget(QLabel('Patient Name: ', self))
36   - hbox.addWidget(self.changeNameField)
  42 + hbox.addWidget(self.changeFirstName)
  43 + hbox.addWidget(self.changeLastName)
37 44 hbox.addWidget(self.editButton)
38 45 hbox.addWidget(self.cancelButton)
39 46
@@ -46,28 +53,42 @@ def nameChange(self):
46 53 if(self.changing):
47 54 self.change()
48 55 else:
49   - self.changeNameField.setReadOnly(False)
50   - self.changeNameField.setFocus()
  56 + self.changeFirstName.setReadOnly(False)
  57 + self.changeFirstName.setText(str(self.patient.nameFirst))
  58 + self.changeFirstName.setFocus()
  59 +
  60 + self.changeLastName.setReadOnly(False)
  61 + self.changeLastName.setVisible(True)
  62 + self.changeLastName.setText(str(self.patient.nameLast))
  63 +
51 64 self.editButton.setText('Done')
52 65 self.cancelButton.setVisible(True)
53 66 self.changing = True
54 67
55 68 def change(self):
56   - if (self.changeNameField.text() != ''):
57   - print("Changing name to: " + self.changeNameField.text())
  69 + if (self.changeFirstName.text() != ''):
  70 + print("Changing name to: " + self.changeFirstName.text() + " " +
  71 + self.changeLastName.text())
  72 + self.patient.nameFirst = self.changeFirstName.text()
  73 + self.patient.nameLast = self.changeLastName.text()
58 74
59 75 self.cancel()
60 76
61 77
62 78 def cancel(self):
63   - self.changeNameField.setReadOnly(True)
  79 + self.changeFirstName.setReadOnly(True)
  80 + self.changeLastName.setReadOnly(True)
  81 + self.changeLastName.setVisible(False)
  82 +
64 83 self.editButton.setText('Edit')
65 84 self.cancelButton.setVisible(False)
66 85
67 86 self.changing = False
  87 + self.changeFirstName.setText(str(self.patient.nameFirst + " " + self.patient.nameLast))
68 88
69   - def setName(self, name):
70   - self.changeNameField.setText(str(name))
  89 + def setPatient(self, p):
  90 + self.patient = p
  91 + self.changeFirstName.setText(str(self.patient.nameFirst + " " + self.patient.nameLast))
71 92
72 93
73 94

0 comments on commit 102afdc

Please sign in to comment.
Something went wrong with that request. Please try again.