示例#1
0
 def __init__(self, **kwargs):
     super(MyTextArea, self).__init__(**kwargs)
     styles = self.style if self.style else {}
     styles.setdefault("selection-color", parse_color("rgb(255, 142, 33)"))
     styles.setdefault("cursor-color", parse_color("rgb(215, 15, 15)"))
     kwargs.setdefault("place_keyboard_by_control", False)
     kwargs.setdefault("get_initial_keyboard_rotation_from", None)
     self.place_keyboard_by_control = kwargs.get("place_keyboard_by_control")
     self.get_initial_keyboard_rotation_from = kwargs.get("get_initial_keyboard_rotation_from")
示例#2
0
文件: myTabs.py 项目: estemenson/CMAP
    def __init__(self, **kwargs):
        self.tab_style = \
        {
         'bg-color': parse_color('rgba(185,211,238, 255)'),
#         'bg-color': parse_color('rgba(219, 219, 219, 255)'),
         'border-color': parse_color('rgba(187, 187, 187,255)'),
         'color-normal': parse_color('rgba(0,0,0,255)'),
         'border-width': 5,
         'draw-border': True,    
         'color': parse_color('rgba(0,0,0,255)'),    
         'border-radius': 5,
         'border-radius-precision': .01
        }
        self.active_tab_style = \
        {
 #        'bg-color': parse_color('rgba(185,211,238, 255)'),
         'bg-color': parse_color('rgba(230, 230, 230, 255)'),
         'border-color': parse_color('rgba(150, 205, 205,255)'),
         'color-normal': parse_color('rgba(0,0,0,255)'),
         'border-width': 10,
         'draw-border': True,    
         'color': parse_color('rgba(0,0,0,255)'),
         'border-radius': 10,
         'border-radius-precision': .01
        }
        super(MyTabs, self).__init__(**kwargs)
        self.cur_button = None
示例#3
0
    def draw(self):
        scaled_border = self.get_scaled_border()
        border_color=self.style.get('border-color')
        if not self.isMinimized:
            # select color from number of touch
            if len(self._touches) == 0:
                set_color(*self.style.get('bg-color'))
            elif len(self._touches) == 1:
                border_color = self.style.get('bg-color-move') 
                set_color(*border_color) #IGNORE:W0142
            else:
                border_color = self.style.get('bg-color-full') 
                set_color(*border_color) #IGNORE:W0142

            # draw border
            drawRoundedRectangle(
                pos=(-scaled_border, -scaled_border*2*self.scale),
                size=(self.width+scaled_border*2, self.height+scaled_border*3*self.scale),
                #size=(self.width+scaled_border*2, self.height+control_height*2),
                radius=15. / self.scale
            )
#            pos = ((self.width/2 - control_width/2),
#                   -scaled_border * 2)
#            size=(control_width, 
#                  control_height) 
#            corners=(True, True, False, False)
        else:
            pos = (0,-scaled_border)
            size=scale_tuple(self.size,-.1,-.5)
            l_pos = (size[0]/2, size[1] - 15 - scaled_border)
            corners=(True, True, True, True)
            drawLabel(label=self.minimized_label, pos=l_pos, 
                      color=self.style.get('font-color'))
            border_color=parse_color(self.style.get('min-border-color'))
            # draw control background
            drawRoundedRectangle(
                pos=pos,
                size=size,
                radius=15. / self.scale,
                corners=corners, color=border_color
            )
示例#4
0
    border-width: 1;
    border-color: rgb(100,100,100);
    border-radius-precision: 1;
    draw-border: 0;
    selection-color: rgb(255, 142, 33);
    cursor-color: rgb(215, 15, 15);

}
'''
css_add_sheet(ScribbleCSS)

from pymt.graphx import set_color
from pymt.ui.widgets.widget import MTWidget


CYAN=parse_color('rgb(0,255,255)')
RED=parse_color('rgb(255,0,0)')
DEFAULT_COLOR=WHITE=parse_color('rgb(255,255,255)')
BLACK=parse_color('rgb(0,0,0)')
DELETED_LINE=parse_color('rgb(30,30,0)')
from os import path
OPEN_SIDE_ICON = path.join(AGILE_ICONS,'arrow-left-double-2.png')
CLOSE_SIDE_ICON = path.join(AGILE_ICONS,'arrow-right-double-2.png')
COLOR_ICON = path.join(AGILE_ICONS,'color_line 48.png')
ERASER_ICON = path.join(AGILE_ICONS,'package_purge 48.png')
PEN_ICON = path.join(AGILE_ICONS,'paint 48.png')


class MySidePanel(MTSidePanel):
    '''
    :Parameters:
示例#5
0
文件: markup.py 项目: Markitox/pymt
    def render(self, real=False):
        w, h = 0, 0
        x, y = 0, 0
        lw, lh = 0, 0
        nl = False
        if real:
            self._render_begin()

        for item in self.markup:
            if item == '[b]':
                self._push_style('bold')
                self.options['bold'] = True
            elif item == '[/b]':
                self._pop_style('bold')
            elif item == '[i]':
                self._push_style('italic')
                self.options['italic'] = True
            elif item == '[/i]':
                self._pop_style('italic')
            elif item.startswith('[size='):
                size = int(item[6:-1])
                self._push_style('font_size')
                self.options['font_size'] = size
            elif item == '[/size]':
                self._pop_style('font_size')
            elif item.startswith('[color='):
                color = parse_color(item[7:-1])
                self._push_style('color')
                self.options['color'] = color
            elif item == '[/color]':
                self._pop_style('color')
            elif item.startswith('[font='):
                fontname = item[6:-1]
                self._push_style('font_name')
                self.options['font_name'] = fontname
            elif item == '[/font]':
                self._pop_style('font_name')
            else:
                args = x, y, w, h, lw, lh, nl
                args = self.render_label(real, item, args)
                x, y, w, h, lw, lh, nl = args

        if not real:
            # was only the first pass
            # return with/height
            w = int(max(w, 1))
            h = int(max(h, 1))
            return w, h

        # get data from provider
        data = self._render_end()
        assert(data)

        # create texture is necessary
        if self.texture is None:
            self.texture = pymt.Texture.create(*self.size)
            self.texture.flip_vertical()
        elif self.width > self.texture.width or self.height > self.texture.height:
            self.texture = pymt.Texture.create(*self.size)
            self.texture.flip_vertical()
        else:
            self.texture = self.texture.get_region(0, 0, self.width, self.height)

        # update texture
        self.texture.blit_data(data)
示例#6
0
文件: markup.py 项目: gavine199/pymt
    def render(self, real=False):
        w, h = 0, 0
        x, y = 0, 0
        lw, lh = 0, 0
        nl = False
        if real:
            self._render_begin()

        for item in self.markup:
            if item == '[b]':
                self._push_style('bold')
                self.options['bold'] = True
            elif item == '[/b]':
                self._pop_style('bold')
            elif item == '[i]':
                self._push_style('italic')
                self.options['italic'] = True
            elif item == '[/i]':
                self._pop_style('italic')
            elif item.startswith('[size='):
                size = int(item[6:-1])
                self._push_style('font_size')
                self.options['font_size'] = size
            elif item == '[/size]':
                self._pop_style('font_size')
            elif item.startswith('[color='):
                color = parse_color(item[7:-1])
                self._push_style('color')
                self.options['color'] = color
            elif item == '[/color]':
                self._pop_style('color')
            elif item.startswith('[font='):
                fontname = item[6:-1]
                self._push_style('font_name')
                self.options['font_name'] = fontname
            elif item == '[/font]':
                self._pop_style('font_name')
            else:
                args = x, y, w, h, lw, lh, nl
                args = self.render_label(real, item, args)
                x, y, w, h, lw, lh, nl = args

        if not real:
            # was only the first pass
            # return with/height
            w = int(max(w, 1))
            h = int(max(h, 1))
            return w, h

        # get data from provider
        data = self._render_end()
        assert (data)

        # create texture is necessary
        if self.texture is None:
            self.texture = pymt.Texture.create(*self.size)
            self.texture.flip_vertical()
        elif self.width > self.texture.width or self.height > self.texture.height:
            self.texture = pymt.Texture.create(*self.size)
            self.texture.flip_vertical()
        else:
            self.texture = self.texture.get_region(0, 0, self.width,
                                                   self.height)

        # update texture
        self.texture.blit_data(data)