示例#1
0
文件: label.py 项目: Xunius/uvcdat
 def set_color(self, cmap, color):
     self.tt.color = color
     self.picker = None
     self.save()
     tprop = self.actor.GetTextProperty()
     tprop.SetBackgroundColor(contrasting_color(*tprop.GetColor()))
     tprop.SetBackgroundOpacity(.85)
示例#2
0
文件: label.py 项目: l5d1l5/uvcdat
 def set_color(self, cmap, color):
     self.tt.color = color
     self.picker = None
     self.save()
     tprop = self.actor.GetTextProperty()
     tprop.SetBackgroundColor(contrasting_color(*tprop.GetColor()))
     tprop.SetBackgroundOpacity(.85)
示例#3
0
文件: label.py 项目: NESII/uvcdat
    def __init__(self, interactor, label, dp, configurator):
        self.label = label
        self.display = dp
        super(LabelEditor, self).__init__(interactor, label, configurator)

        self.toolbar = vcs.vtk_ui.Toolbar(
            self.interactor,
            "%s Options" %
            label.member)
        template = vcs.gettemplate(dp.template)

        self.actor = get_actor(self.label, self.display)

        tprop = self.actor.GetTextProperty()
        self.real_bg = tprop.GetBackgroundColor()
        self.real_bg_opacity = tprop.GetBackgroundOpacity()

        tprop.SetBackgroundColor(contrasting_color(*tprop.GetColor()))
        tprop.SetBackgroundOpacity(.85)

        text_types_name = template.name + "_" + label.member

        try:
            self.tt = vcs.gettexttable(text_types_name)
            self.to = vcs.gettextorientation(text_types_name)
        except ValueError:
            self.tt = vcs.createtexttable(text_types_name, label.texttable)
            self.to = vcs.createtextorientation(
                text_types_name,
                label.textorientation)

        self.height_button = self.toolbar.add_slider_button(
            self.to.height,
            1,
            100,
            "Height",
            update=self.update_height)

        halign = self.toolbar.add_button(
            ["Left Align", "Center Align", "Right Align"], action=self.halign)
        valign = self.toolbar.add_button(
            ["Top Align", "Half Align", "Bottom Align"], action=self.valign)

        halign.set_state(self.to.halign)
        valign.set_state(__valign_map__[self.to.valign])

        self.angle_button = self.toolbar.add_slider_button(
            self.to.angle,
            0,
            360,
            "Angle",
            update=self.update_angle)

        self.picker = None
        self.toolbar.add_button(["Change Color"], action=self.change_color)
        self.toolbar.show()
        self.label.texttable = self.tt.name
        self.label.textorientation = self.to.name
示例#4
0
    def __init__(self, interactor, label, dp, configurator):
        self.label = label
        self.display = dp
        super(LabelEditor, self).__init__(interactor, label, configurator)

        self.toolbar = vcs.vtk_ui.Toolbar(self.interactor,
                                          "%s Options" % label.member)
        template = vcs.gettemplate(dp.template)

        self.actor = get_actor(self.label, self.display)

        tprop = self.actor.GetTextProperty()
        self.real_bg = tprop.GetBackgroundColor()
        self.real_bg_opacity = tprop.GetBackgroundOpacity()

        tprop.SetBackgroundColor(contrasting_color(*tprop.GetColor()))
        tprop.SetBackgroundOpacity(.85)

        text_types_name = template.name + "_" + label.member

        try:
            self.tt = vcs.gettexttable(text_types_name)
            self.to = vcs.gettextorientation(text_types_name)
        except ValueError:
            self.tt = vcs.createtexttable(text_types_name, label.texttable)
            self.to = vcs.createtextorientation(text_types_name,
                                                label.textorientation)

        self.height_button = self.toolbar.add_slider_button(
            self.to.height, 1, 100, "Height", update=self.update_height)

        halign = self.toolbar.add_button(
            ["Left Align", "Center Align", "Right Align"], action=self.halign)
        valign = self.toolbar.add_button(
            ["Top Align", "Half Align", "Bottom Align"], action=self.valign)

        halign.set_state(self.to.halign)
        valign.set_state(__valign_map__[self.to.valign])

        self.angle_button = self.toolbar.add_slider_button(
            self.to.angle, 0, 360, "Angle", update=self.update_angle)

        self.picker = None
        self.toolbar.add_button(["Change Color"], action=self.change_color)
        # Adds itself to self.toolbar automatically
        FontEditor(self.toolbar,
                   self.set_font,
                   current_font=vcs.getfontname(self.tt.font))
        self.toolbar.show()
        self.label.texttable = self.tt.name
        self.label.textorientation = self.to.name
def test(fg):
    bg = contrasting_color(*fg)
    print "\tTesting", fg, "vs", bg
    return passes_w3c_contrast_ratio(fg, bg)
def test(fg):
    bg = contrasting_color(*fg)
    print "\tTesting", fg, "vs", bg
    return passes_w3c_contrast_ratio(fg, bg)