Example #1
0
    def __init__(self, parent, **kwds):
        super(PDFViewer, self).__init__(parent, **kwds)

        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(bitmap_from_base64(icon_16_b64))
        self.SetIcon(_icon)

        pane_cont = self.GetContentsPane()
        self.buttonpanel = pdfButtonPanel(pane_cont, wx.NewId(),
                                          wx.DefaultPosition, wx.DefaultSize, 0)
        self.buttonpanel.SetSizerProps(expand=True)
        self.viewer = pdfViewer(pane_cont, wx.NewId(), wx.DefaultPosition,
                                wx.DefaultSize,
                                wx.HSCROLL|wx.VSCROLL|wx.SUNKEN_BORDER)
        self.viewer.UsePrintDirect = ``False``
        self.viewer.SetSizerProps(expand=True, proportion=1)

        self.buttonpanel.viewer = self.viewer
        self.viewer.buttonpanel = self.buttonpanel
Example #2
0
    def __init__(self, parent):
        wx.Frame.__init__(
            self,
            title='Auto MO',
            parent=parent,
            style=wx.DEFAULT_FRAME_STYLE,
            size=wx.Size(800, 600)
            )

        _icon = wx.EmptyIcon()
        _icon.CopyFromBitmap(bitmap_from_base64(icon_16_b64))
        self.SetIcon(_icon)

        self.session = Session()

        self.patients = []
        self.selected_patient = None

        self._init_ctrls()
        self._init_menu()

        self.patient_list_panel.UpdateList()
Example #3
0
    def __init__(self, parent):
        super(AboutDlg, self).__init__(parent,
                                       wx.ID_ANY,
                                       title="About",
                                       size=(300, 360))

        image = bitmap_from_base64(icon_robot_b64)

        name = 'Auto MO'
        description = wordwrap(
            "Program to automate the tedious job of hand writing prescriptions everyday."
            "", 250, wx.ClientDC(self))
        version = __version__
        website = "https://github.com/aliaafee/automo"
        copyrights = "(C) 2017 Ali Aafee"

        sizer = wx.BoxSizer(wx.VERTICAL)

        ctrl = wx.StaticText(self,
                             label=name + " " + version,
                             size=wx.Size(-1, -1))
        ctrl.SetFont(wx.Font(18, wx.FONTFAMILY_TELETYPE, wx.NORMAL, wx.BOLD))
        sizer.Add(ctrl, 0, wx.ALIGN_CENTER | wx.TOP, border=20)

        ctrl = wx.StaticBitmap(self, 1, image, (10, 5),
                               (image.GetWidth(), image.GetHeight()))
        sizer.Add(ctrl, 0, wx.ALIGN_CENTER | wx.ALL, border=10)

        ctrl = wx.StaticText(self, label=description, size=wx.Size(-1, -1))
        sizer.Add(ctrl, 0, wx.ALIGN_CENTER | wx.ALL, border=10)

        ctrl = hl.HyperLinkCtrl(self, -1, website, URL=website)
        sizer.Add(ctrl, 0, wx.ALIGN_CENTER | wx.ALL, border=10)

        ctrl = wx.StaticText(self, label=copyrights, size=wx.Size(-1, -1))
        sizer.Add(ctrl, 0, wx.ALIGN_CENTER | wx.ALL, border=10)

        self.SetSizer(sizer)
Example #4
0
    def __init__(self, parent, session, patient_panel, **kwds):
        super(DrugAddPanel, self).__init__(parent, **kwds)

        self.session = session
        self.patient_panel = patient_panel

        top_sizer = wx.BoxSizer(wx.VERTICAL)

        sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.lbl_drug_name = wx.StaticText(self,
                                           label="Medication",
                                           size=wx.Size(-1, -1))
        sizer.Add(self.lbl_drug_name,
                  1,
                  wx.RIGHT | wx.TOP | wx.EXPAND,
                  border=5)

        self.lbl_drug_order = wx.StaticText(self,
                                            label="Order",
                                            size=wx.Size(-1, -1))
        sizer.Add(self.lbl_drug_order,
                  1,
                  wx.RIGHT | wx.TOP | wx.EXPAND,
                  border=5)

        self.lbl_add = wx.StaticText(self, label=" ", size=wx.Size(50, -1))
        sizer.Add(self.lbl_add, 0, wx.TOP, border=5)

        top_sizer.Add(sizer, 1, wx.EXPAND)

        sizer = wx.BoxSizer(wx.HORIZONTAL)

        self.txt_drug_name = AcDbTextCtrl(self, self.session, Drug)
        self.txt_drug_name.Bind(wx.EVT_KEY_UP, self.OnDrugNameKeyUp)
        sizer.Add(self.txt_drug_name,
                  1,
                  wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                  border=5)

        self.txt_drug_order = wx.TextCtrl(self, size=wx.Size(-1, -1))
        self.txt_drug_order.Bind(wx.EVT_KEY_UP, self.OnDrugOrderKeyUp)
        sizer.Add(self.txt_drug_order,
                  1,
                  wx.RIGHT | wx.BOTTOM | wx.EXPAND,
                  border=5)

        self.btn_add = wx.BitmapButton(
            self,
            bitmap=bitmap_from_base64(toolbar_add_24_b64),
            style=wx.BU_AUTODRAW,
            size=wx.Size(24, 24))
        self.btn_add.SetToolTipString("Add Medication")
        self.btn_add.Bind(wx.EVT_BUTTON, self.OnAddDrug)
        sizer.Add(self.btn_add,
                  0,
                  wx.RIGHT | wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL,
                  border=5)

        self.btn_preset = wx.Button(self, label="...", size=wx.Size(24, 24))
        self.btn_preset.SetToolTipString("Preset Prescriptions")
        self.btn_preset.Bind(wx.EVT_BUTTON, self.OnPresetMenu)
        sizer.Add(self.btn_preset,
                  0,
                  wx.BOTTOM | wx.ALIGN_CENTER_VERTICAL,
                  border=5)

        top_sizer.Add(sizer, 1, wx.EXPAND)

        self.SetSizer(top_sizer)
Example #5
0
    def __init__(self,
                 parent,
                 session,
                 history_table,
                 size=wx.Size(-1, 400),
                 **kwds):
        super(HistoryEditor,
              self).__init__(parent,
                             style=wx.CLOSE_BOX | wx.RESIZE_BORDER
                             | wx.SYSTEM_MENU | wx.CAPTION,
                             size=size,
                             **kwds)

        self.session = session
        self.history_table = history_table

        grid_sizer = wx.GridBagSizer(0, 0)

        self.btn_filter = wx.BitmapButton(
            self,
            bitmap=bitmap_from_base64(toolbar_filter_24_b64),
            style=wx.BU_AUTODRAW,
            size=wx.Size(24, 24))
        self.btn_filter.SetToolTipString("Filter")
        self.btn_filter.Bind(wx.EVT_BUTTON, self._on_change_filter)
        grid_sizer.Add(self.btn_filter,
                       wx.GBPosition(0, 0),
                       flag=wx.LEFT | wx.BOTTOM | wx.TOP
                       | wx.ALIGN_CENTER_VERTICAL,
                       border=5)

        self.txt_filter = wx.TextCtrl(self)
        self.txt_filter.Bind(wx.EVT_TEXT, self._on_change_filter)
        grid_sizer.Add(self.txt_filter,
                       wx.GBPosition(0, 1),
                       flag=wx.EXPAND | wx.ALL,
                       border=5)

        self.history_list = ObjectListViewMod(
            self,
            style=wx.LC_REPORT | wx.SUNKEN_BORDER,
            cellEditMode=ObjectListView.CELLEDIT_DOUBLECLICK)
        grid_sizer.Add(self.history_list,
                       wx.GBPosition(1, 0),
                       wx.GBSpan(2, 2),
                       flag=wx.EXPAND | wx.ALL,
                       border=0)

        self.history_list.SetColumns([
            ColumnDefn("", "", 0, "id", isEditable=False),
            ColumnDefn(self.GetTitle(), "left", 300, "name", isEditable=True)
        ])

        self.history_list.SetEmptyListMsg("")
        self.history_list.useAlternateBackColors = False
        self.history_list.Bind(OLVEvent.EVT_CELL_EDIT_FINISHED,
                               self._on_cell_edit_finished)
        self.history_list.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK,
                               self._on_history_context_menu)

        self.history_menu = wx.Menu()
        menu_id = 700
        self.history_menu.Append(menu_id, "Remove", "Remove Item From History")
        wx.EVT_MENU(self, menu_id, self.on_remove_item)

        grid_sizer.AddGrowableCol(1)
        grid_sizer.AddGrowableRow(1)
        self.SetSizer(grid_sizer)

        self.txt_filter.SetFocus()

        self.update_list()
Example #6
0
    def __init__(self, parent, session, **kwds):
        super(PatientPanel, self).__init__(parent, **kwds)

        self.session = session
        self.patient_list_panel = None

        self.patient = None

        sizer = wx.BoxSizer(wx.VERTICAL)

        self.toolbar = wx.ToolBar(self, style=wx.TB_NODIVIDER)

        self.tb_print = self.toolbar.AddLabelTool(
            wx.ID_ANY, 'Print', bitmap_from_base64(toolbar_print_one_b64),
            shortHelp="Print Prescription")
        self.Bind(wx.EVT_TOOL, self.OnPrint, self.tb_print)

        self.toolbar.AddStretchableSpace()

        self.lbl_doctor = wx.StaticText(self.toolbar, label="Doctor's Name  ", size=wx.Size(-1, -1))
        self.toolbar.AddControl(self.lbl_doctor)
        self.txt_doctor = AcDbTextCtrl(self.toolbar, self.session, Doctor)
        self.toolbar.AddControl(self.txt_doctor)

        self.toolbar.Realize()

        sizer.Add(self.toolbar, 0, wx.ALL | wx. EXPAND)

        grid_sizer = wx.FlexGridSizer(8, 2, 5, 5)
        grid_sizer.AddGrowableCol(1, 1)

        label_width = 100

        self.lbl_bed = wx.StaticText(self, label='Bed', size=wx.Size(label_width, -1))
        self.txt_bed = DbTextCtrl(self, self.session, self.OnChangeList)
        grid_sizer.Add(self.lbl_bed, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_bed, 1, wx.EXPAND)

        self.lbl_hospital_no = wx.StaticText(self, label='Hospital No',
                                             size=wx.Size(label_width, -1))
        self.txt_hospital_no = DbTextCtrl(self, self.session, self.OnChangeList)
        grid_sizer.Add(self.lbl_hospital_no, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_hospital_no, 1, wx.EXPAND)

        self.lbl_national_id_no = wx.StaticText(self, label='National Id No',
                                                size=wx.Size(label_width, -1))
        self.txt_national_id_no = DbTextCtrl(self, self.session)
        grid_sizer.Add(self.lbl_national_id_no, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_national_id_no, 1, wx.EXPAND)

        self.lbl_name = wx.StaticText(self, label='Name', size=wx.Size(label_width, -1))
        self.txt_name = DbTextCtrl(self, self.session, self.OnChangeList)
        grid_sizer.Add(self.lbl_name, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_name, 1, wx.EXPAND)

        self.lbl_age = wx.StaticText(self, label='Age', size=wx.Size(label_width, -1))
        self.txt_age = DbTextCtrl(self, self.session)
        grid_sizer.Add(self.lbl_age, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_age, 1, wx.EXPAND)

        self.lbl_sex = wx.StaticText(self, label='Sex', size=wx.Size(label_width, -1))
        self.txt_sex = DbTextCtrl(self, self.session)
        grid_sizer.Add(self.lbl_sex, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_sex, 1, wx.EXPAND)

        self.lbl_diagnosis = wx.StaticText(self, label='Diagnosis', size=wx.Size(label_width, -1))
        self.txt_diagnosis = AcDbTextCtrl(self, self.session, Diagnosis)
        grid_sizer.Add(self.lbl_diagnosis, 1, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
        grid_sizer.Add(self.txt_diagnosis, 1, wx.EXPAND)

        sizer.Add(grid_sizer, 0, wx.ALL | wx.EXPAND, border=10)

        self.txt_drug_name = DrugAddPanel(self, self.session, self)
        sizer.Add(self.txt_drug_name, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, border=10)

        self.prescription_list = ObjectListViewMod(
            self,
            style=wx.LC_REPORT|wx.SUNKEN_BORDER,
            cellEditMode=ObjectListView.CELLEDIT_DOUBLECLICK
        )

        self.prescription_list.SetColumns([
            ColumnDefn("Drug", "left", 180, "drug_name", isEditable=False),
            ColumnDefn("Order", "left", 140, "drug_order")
        ])

        self.prescription_list.SetEmptyListMsg("")
        self.prescription_list.useAlternateBackColors = False
        self.prescription_list.CreateCheckStateColumn()

        self.prescription_list.Bind(EVT_OVL_CHECK_EVENT, self.OnRxCheck)
        self.prescription_list.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRxContextMenu)
        self.prescription_list.Bind(OLVEvent.EVT_CELL_EDIT_FINISHED, self.OnCellEditFinished)

        sizer.Add(self.prescription_list, 1, wx.RIGHT | wx.LEFT | wx.BOTTOM | wx. EXPAND, border=10)

        #Enter Treversal
        self.txt_bed.Bind(wx.EVT_KEY_UP, self.OntxtBedKeyUp)
        self.txt_hospital_no.Bind(wx.EVT_KEY_UP, self.OntxtHospitalNoKeyUp)
        self.txt_national_id_no.Bind(wx.EVT_KEY_UP, self.OntxtNationalIdNoKeyUp)
        self.txt_name.Bind(wx.EVT_KEY_UP, self.OntxtNameKeyUp)
        self.txt_age.Bind(wx.EVT_KEY_UP, self.OntxtAgeKeyUp)
        self.txt_sex.Bind(wx.EVT_KEY_UP, self.OntxtSexKeyUp)
        self.txt_diagnosis.Bind(wx.EVT_KEY_UP, self.OntxtDiagnosisKeyUp)

        self.SetSizer(sizer)

        self.rx_menu = wx.Menu()
        menu_id = 500
        self.rx_menu.Append(menu_id, "Remove", "Remove Medication.")
        wx.EVT_MENU(self, menu_id, self.OnRemoveRx)
        menu_id = 501
        self.rx_menu.Append(menu_id, "Tick All", "Tick All Medications")
        wx.EVT_MENU(self, menu_id, self.OnTickAllRx)
        menu_id = 502
        self.rx_menu.Append(menu_id, "Untick All", "Untick All Medications")
        wx.EVT_MENU(self, menu_id, self.OnUntickAllRx)

        self.unset()