def init_css(self): ''' # ensure that css files are up to date.we have a css file.. # otherwise the layout will be awful! ''' CommonSettings.init_css(self) for css in ("notes", "details"): resource = QtCore.QResource(":css/%s.css"% css) if resource.isCompressed(): data = QtCore.qUncompress(resource.data()) else: data = resource.data() default_loc = os.path.join(self.LOCALFOLDER, "%s.css"% css) try: f = open(default_loc, "r") css_data = f.read() f.close() if css_data == data: LOGGER.debug("%s is current"% default_loc) continue except IOError: pass print "initiating a new css file - %s"% default_loc f = open(default_loc, "w") f.write(data) f.close()
def __init__(self): CommonSettings.__init__(self) self.COLOURS = COLOURS #: a reference to a :doc:`TeethPresentDecoder` self.tooth_decoder = TeethPresentDecoder() #: who is using the system self.user = "******" #: who is logged in as user1 self.user1 = None #: and assistant self.user2 = None #: a pointer to the :doc:`ClientConnection` in use self.psql_conn = None #: an enumeration of chart styles self.chart_styles = ( (_("Mixed"), 1), (_("Deciduous"), 2), (_("Adult Simple"), 3), (_("Adult Complex"), 4), (_("Adult Complex PLUS"), 4.5), (_("Roots Only"), 5), (_("Perio Chart"), 6), ) #: initially this is "Adult Complex" self.default_chart_style = 4 #: only adult rows, as per style 4 self.visible_chart_rows = (1,2) #: colours for fillings self.fill_materials = ( ("?", self.COLOURS.UNKNOWN), ("AM", self.COLOURS.AMALGAM), ("CO", self.COLOURS.COMPOSITE), ("GL", self.COLOURS.GLASS), ("PO", self.COLOURS.PORCELAIN), ("GO", self.COLOURS.GOLD) ) #: a reference to the :doc:`ClientMainWindow` for plugin use self.mainui = None self._fee_scales = [] self._current_patient = None self._current_practitioner = None self._practitioners = None self._treatment_model = None self._staff = None self._users = None self._last_known_address = None self._text_fields = None
class TestCase(unittest.TestCase): def setUp(self): self.settings = CommonSettings() def tearDown(self): pass def test_convert_tooth_shortname(self): self.assertEqual(self.settings.convert_tooth_shortname("UR8"), 1)
@property def is_connected(self): ''' does this widget have an open connection to a postgres database? ''' return self.pg_session and self.pg_session.isOpen() def _test(): app = QtGui.QApplication([]) conn_data = ConnectionData() conn_data.demo_connection() session = OpenmolarDatabase(conn_data) session.connect() psw = PostgresSessionWidget() psw.set_session(session) psw.update_status() psw.show() app.exec_() if __name__ == "__main__": import __builtin__ import logging __builtin__.LOGGER = logging.getLogger() from lib_openmolar.common.settings import CommonSettings SETTINGS = CommonSettings() import gettext gettext.install("openmolar") _test()
def setUp(self): self.settings = CommonSettings()
def __init__(self): CommonSettings.__init__(self) self.VERSION self.load()