def test_update(self): obj = QPen( Qt.red, 2, Qt.SolidLine ) ls = LineStyleParam(_("Line style")) ls.update_param( obj ) self.assertEqual(ls.width, 2) self.assertEqual(ls.style, "SolidLine") self.assertEqual(ls.color, "#ff0000")
def test_update(self): obj = QPen(Qt.red, 2, Qt.SolidLine) ls = LineStyleParam(_("Line style")) ls.update_param(obj) self.assertEqual(ls.width, 2) self.assertEqual(ls.style, "SolidLine") self.assertEqual(ls.color, "#ff0000")
def gridparam(self, background=None, major_enabled=None, minor_enabled=None, major_style=None, minor_style=None): """ Make `guiqwt.styles.GridParam` instance * background = canvas background color * major_enabled = tuple (major_xenabled, major_yenabled) * minor_enabled = tuple (minor_xenabled, minor_yenabled) * major_style = tuple (major_xstyle, major_ystyle) * minor_style = tuple (minor_xstyle, minor_ystyle) Style: tuple (style, color, width) """ gridparam = GridParam(title=_("Grid"), icon="lin_lin.png") gridparam.read_config(CONF, "plot", "grid") if background is not None: gridparam.background = background if major_enabled is not None: gridparam.maj_xenabled, gridparam.maj_yenabled = major_enabled if minor_enabled is not None: gridparam.min_xenabled, gridparam.min_yenabled = minor_enabled if major_style is not None: style = LineStyleParam() linestyle, color, style.width = major_style style.set_style_from_matlab(linestyle) style.color = COLORS.get(color, color) # MATLAB-style if minor_style is not None: style = LineStyleParam() linestyle, color, style.width = minor_style style.set_style_from_matlab(linestyle) style.color = COLORS.get(color, color) # MATLAB-style return gridparam
def test_changeconfig(self): obj = QPen(Qt.red, 2, Qt.SolidLine) ls = LineStyleParam(_("Line style")) ls.update_param(obj) ls.write_config(CONF, "ls", "") ls = LineStyleParam(_("Line style")) ls.read_config(CONF, "ls", "") self.assertEqual(ls.width, 2) self.assertEqual(ls.style, "SolidLine") self.assertEqual(ls.color, "#ff0000")
def test_changeconfig(self): obj = QPen( Qt.red, 2, Qt.SolidLine ) ls = LineStyleParam(_("Line style")) ls.update_param( obj ) ls.write_config(CONF, "ls", "" ) ls = LineStyleParam(_("Line style")) ls.read_config(CONF, "ls", "" ) self.assertEqual(ls.width, 2) self.assertEqual(ls.style, "SolidLine") self.assertEqual(ls.color, "#ff0000")
def test_saveconfig(self): ls = LineStyleParam(_("Line style")) ls.write_config(CONF, "ls", "") ls = LineStyleParam(_("Line style")) ls.read_config(CONF, "ls", "")
def test_default(self): ls = LineStyleParam(_("Line style")) _obj = ls.build_pen()
def test_saveconfig(self): ls = LineStyleParam(_("Line style")) ls.write_config(CONF, "ls", "" ) ls = LineStyleParam(_("Line style")) ls.read_config(CONF, "ls", "" )