class _TestDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        super(_TestDialog, self).__init__(parent)
        self.proc_code_dock_widget = None

        self.page = TreatmentPage(self)

        toolbar = QtGui.QToolBar(self)

        test_all = QtGui.QAction("Add all txs", self)
        test_all.triggered.connect(self.test_all)

        toolbar.addAction(test_all)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.page)
        layout.addWidget(toolbar)
        self.connect_signals()

        self.page.load_patient()

    def connect_signals(self):
        self.connect(self.page, QtCore.SIGNAL("Show Fee Widget"),
                     self.call_fee_widget)

    def call_fee_widget(self):
        if self.proc_code_dock_widget != None:
            state = self.proc_code_dock_widget.isVisible()
            self.proc_code_dock_widget.setVisible(not state)
            return

        from lib_openmolar.client.qt4.widgets.procedures.proc_code_widget \
            import ProcCodeDockWidget

        self.proc_code_dock_widget = ProcCodeDockWidget(self)
        self.connect(self.proc_code_dock_widget,
                     QtCore.SIGNAL("Code Selected"),
                     self.page.proc_code_selected)

        self.proc_code_dock_widget.show()
        self.proc_code_dock_widget.setFloating(True)

    def test_all(self):
        '''
        iterate over the procedure codes, and show them all
        '''
        for code in SETTINGS.PROCEDURE_CODES:
            self.page.proc_code_selected(code)
    def call_fee_widget(self):
        if self.proc_code_dock_widget != None:
            state = self.proc_code_dock_widget.isVisible()
            self.proc_code_dock_widget.setVisible(not state)
            return

        from lib_openmolar.client.qt4.widgets.procedures.proc_code_widget \
            import ProcCodeDockWidget

        self.proc_code_dock_widget = ProcCodeDockWidget(self)
        self.connect(self.proc_code_dock_widget,
                     QtCore.SIGNAL("Code Selected"),
                     self.page.proc_code_selected)

        self.proc_code_dock_widget.show()
        self.proc_code_dock_widget.setFloating(True)
 def proc_code_dock_widget(self):
     if self._proc_code_dock_widget is None:
         self._proc_code_dock_widget = ProcCodeDockWidget(self)
         self.connect(self._proc_code_dock_widget,
                      QtCore.SIGNAL("Code Selected"),
                      self.treatment_page.proc_code_selected)
     return self._proc_code_dock_widget
class _TestDialog(QtGui.QDialog):
    def __init__(self, parent=None):
        super(_TestDialog, self).__init__(parent)
        self.proc_code_dock_widget = None

        self.page = TreatmentPage(self)

        toolbar = QtGui.QToolBar(self)

        test_all = QtGui.QAction("Add all txs", self)
        test_all.triggered.connect(self.test_all)

        toolbar.addAction(test_all)

        layout = QtGui.QVBoxLayout(self)
        layout.addWidget(self.page)
        layout.addWidget(toolbar)
        self.connect_signals()

        self.page.load_patient()

    def connect_signals(self):
        self.connect(self.page, QtCore.SIGNAL("Show Fee Widget"), self.call_fee_widget)

    def call_fee_widget(self):
        if self.proc_code_dock_widget != None:
            state = self.proc_code_dock_widget.isVisible()
            self.proc_code_dock_widget.setVisible(not state)
            return

        from lib_openmolar.client.qt4.widgets.procedures.proc_code_widget import ProcCodeDockWidget

        self.proc_code_dock_widget = ProcCodeDockWidget(self)
        self.connect(self.proc_code_dock_widget, QtCore.SIGNAL("Code Selected"), self.page.proc_code_selected)

        self.proc_code_dock_widget.show()
        self.proc_code_dock_widget.setFloating(True)

    def test_all(self):
        """
        iterate over the procedure codes, and show them all
        """
        for code in SETTINGS.PROCEDURE_CODES:
            self.page.proc_code_selected(code)
    def call_fee_widget(self):
        if self.proc_code_dock_widget != None:
            state = self.proc_code_dock_widget.isVisible()
            self.proc_code_dock_widget.setVisible(not state)
            return

        from lib_openmolar.client.qt4.widgets.procedures.proc_code_widget import ProcCodeDockWidget

        self.proc_code_dock_widget = ProcCodeDockWidget(self)
        self.connect(self.proc_code_dock_widget, QtCore.SIGNAL("Code Selected"), self.page.proc_code_selected)

        self.proc_code_dock_widget.show()
        self.proc_code_dock_widget.setFloating(True)