예제 #1
0
 def _multi_label(self, x1, x2, y, subtexts):
     if type(subtexts) is str:
         return text(x1, y, subtexts, self._fonts[0]),
     elif len(subtexts) < 2 or not subtexts[1]:
         return text(x1, y, subtexts[0], self._fonts[0]),
     else:
         T1 = text(x1, y, subtexts[0], self._fonts[0])
         T2 = text(x2, y, subtexts[1], self._fonts[1], align=-1, left=x1 + T1[3] + 10)
         return T1, T2
예제 #2
0
 def _multi_label(self, x1, x2, y, subtexts):
     if type(subtexts) is str:
         return text(x1, y, subtexts, self._fonts[0]),
     elif len(subtexts) < 2 or not subtexts[1]:
         return text(x1, y, subtexts[0], self._fonts[0]),
     else:
         T1 = text(x1, y, subtexts[0], self._fonts[0])
         T2 = text(x2,
                   y,
                   subtexts[1],
                   self._fonts[1],
                   align=-1,
                   left=x1 + T1[3] + 10)
         return T1, T2
예제 #3
0
파일: kookies.py 프로젝트: moyogo/knockout
 def __init__(self, x, y, width, height, callback=None, name=''):
     Kookie.__init__(self, x, y, width, height)
     self._callback = callback
     
     self.is_over_hover = self.is_over
     
     self._label = text(x + width/2, self.y_bottom - self._height/2 + 5, name, ISTYLES[('strong',)], align=0)
예제 #4
0
    def __init__(self, recent, queue_draw, h=400, k=300):
        self.queue_draw = queue_draw

        self.h = h
        self.k = k
        self.x0 = int((window.get_h() - h) * 0.5)
        self.y0 = int((window.get_k() - k) * 0.5)
        self.x_center = int(h * 0.5)

        self.HOV = None,

        fontsize = 48
        logo = text(self.x_center,
                    0,
                    'KNOCKOUT',
                    ISTYLES[('splash', )],
                    fontsize=fontsize,
                    align=0,
                    grid=True)

        self.rectangles, sorts = zip(*make_rects(logo, 50, fontsize, 10, 20))
        self.sorts = logo[0], logo[1], sorts

        self.snow = list(make_snow(self.x_center, 100, h * 0.8, k * 0.8, 220))

        self._recent_y = 160
        self.recent = recent
예제 #5
0
파일: kookies.py 프로젝트: moyogo/knockout
 def _construct(self, font, signals):
     self._button_width = self._width/len(signals)
     x0 = self._x - self._width // 2
     buttons = []
     for signal in signals:
         buttons.append((int(round(x0)), text(x0 + self._button_width/2, self.y_bottom - self._height/2 + 5, signal[1], font, align=0)))
         x0 += self._button_width
     return buttons
예제 #6
0
 def _construct(self, font):
     # build menu
     x = self._x + 10
     y = self._y + font['fontsize'] + 5
     iht = self._item_height
     return (font['font'], font['fontsize']), [
         text(x, y + iht * i, signal[1], font)
         for i, signal in enumerate(self._signals)
     ]
예제 #7
0
 def __init__(self, width, name):
     self.k = 36
     self._from_top = self.k - 29
     
     self._zero = int(width*0.5) - 55
     self._one  = int(width*0.5) + 55
     self._anchors = anchors = self._zero, self._zero + 24, self._one - 52 + 12, self._one - 26 + 6
     
     self._label   = text((anchors[1] + anchors[2])*0.5 - 6, self.k - 11, name, ISTYLES[('strong',)], align=0)
예제 #8
0
 def store(self, value):
     self._value = value
     self._O = self._value
     
     if self._objlabel is None:
         try:
             self._objlabel = next(label for O, label in self._menu_options if O == value)
         except StopIteration:
             self._objlabel = str(value)
     self._current = text(32, self._font['fontsize'] + 3, self._objlabel, self._font)
예제 #9
0
파일: kookies.py 프로젝트: kobaisi/Knockout
    def __init__(self, x, y, width, height, callback=None, name=''):
        Kookie.__init__(self, x, y, width, height)
        self._callback = callback

        self.is_over_hover = self.is_over

        self._label = text(x + width / 2,
                           self.y_bottom - self._height / 2 + 5,
                           name,
                           ISTYLES[('strong', )],
                           align=0)
예제 #10
0
파일: kookies.py 프로젝트: kobaisi/Knockout
 def _construct(self, font, signals):
     self._button_width = self._width / len(signals)
     x0 = self._x - self._width // 2
     buttons = []
     for signal in signals:
         buttons.append((int(round(x0)),
                         text(x0 + self._button_width / 2,
                              self.y_bottom - self._height / 2 + 5,
                              signal[1],
                              font,
                              align=0)))
         x0 += self._button_width
     return buttons
예제 #11
0
 def _construct_table(self, margin=0):
     cells = []
     x = 0
     y = 0
     ch = self._cellwidth
     ck = self._cellheight
     mp = ch/2
     font = ISTYLES[('strong',)]
     for row in chunks(self._table, self._per_row):
         cells.extend(((x + ch*i + margin, y + margin, ch - 2*margin, ck - 2*margin), 
                         text(x + ch*i + mp, y + 18, cell[1], font, align=0)) for i, cell in enumerate(row))
         y += ck
     self._cells = cells
예제 #12
0
파일: kookies.py 프로젝트: kobaisi/Knockout
    def __init__(self,
                 x,
                 y,
                 width,
                 height,
                 get_text,
                 font=('title', ),
                 fontsize=None,
                 upper=False):
        Kookie.__init__(self, x, y, width, height)

        font = ISTYLES[font]
        self._typeset_text = lambda: text(
            x, y + fontsize, get_text(), font, fontsize=fontsize, upper=upper)
        self.read()
예제 #13
0
 def __init__(self, width, name, mx, my, ms, minform, menu_options):
     self._mx = mx
     self._my = my
     self._msource = ms
     self._minform = minform
     
     self._dropdown_active = False
     
     self.k = 32
     
     self._font = ISTYLES[('strong',)]
     self._menu_options = menu_options
     self._objlabel = None
     
     self._label = text(32, 32, name, ISTYLES[('label',)])
예제 #14
0
 def __init__(self, width, name):
     self.k = 32
     
     self._set_text_bounds(width)
     self._label = text(self._text_left, 40, name, ISTYLES[('label',)])
     
     # cursors
     self._active = False
     self._i = 0
     self._j = self._i
     
     self._resting_bar_color = (0, 0, 0, 0.4)
     self._active_bar_color = (0, 0, 0, 0.8)
     self._resting_text_color = (0, 0, 0, 0.6)
     self._active_text_color = (0, 0, 0, 1)
     
     self._scroll = 0
예제 #15
0
파일: kookies.py 프로젝트: kobaisi/Knockout
    def __init__(self,
                 x,
                 y,
                 cellwidth,
                 height,
                 default,
                 callback=None,
                 signals=(),
                 longstrings=None):
        Tabs.__init__(self, x, y, cellwidth, height, default, callback,
                      signals)

        font = ISTYLES[('strong', )]
        self._state_labels = [
            text(x, self.y_bottom + 20, label, font, align=0)
            for label in longstrings
        ]
예제 #16
0
 def __init__(self, width, name, supernode, mx, my, ms, minform):
     self._mx = mx
     self._my = my
     self._msource = ms
     self._minform = minform
     
     self._dropdown_active = False
     
     self.k = 32
     self._supernode = supernode
     
     self._NAMEWIDGET = BS(width - 80, name)
     
     self._d1 = 30
     self._d2 = width - 50
     self._d3 = width - 26
     self._O = None###
     
     nonelabelfont = ISTYLES[('strong',)]
     self._nonelabel = text(self._d1 + 16, nonelabelfont['fontsize'] + 5, 'NEW', nonelabelfont)
예제 #17
0
파일: splash.py 프로젝트: kelvin13/Knockout
    def __init__(self, recent, queue_draw, h=400, k=300):
        self.queue_draw  = queue_draw
        
        self.h    = h
        self.k    = k
        self.x0   = int((window.get_h() - h)*0.5)
        self.y0   = int((window.get_k() - k)*0.5)
        self.x_center  = int(h*0.5)
        
        self.HOV = None,
        
        fontsize  = 48
        logo = text(self.x_center, 0, 'KNOCKOUT', ISTYLES[('splash',)], fontsize=fontsize, align=0, grid=True)

        self.rectangles, sorts = zip( * make_rects(logo, 50, fontsize, 10, 20) )
        self.sorts = logo[0], logo[1], sorts
        
        self.snow = list(make_snow(self.x_center, 100, h*0.8, k*0.8, 220))
        
        self._recent_y = 160
        self.recent = recent
예제 #18
0
 def arrange_recent(self, x, y):
     linespacing = self.linespacing
     for i, recent in enumerate(self.recent):
         yield text(x, y + (i + 1) * linespacing, recent, self.font)
예제 #19
0
파일: kookies.py 프로젝트: moyogo/knockout
 def __init__(self, x, y, width, height, get_text, font=('title',), fontsize=None, upper=False):
     Kookie.__init__(self, x, y, width, height)
     
     font = ISTYLES[font]
     self._typeset_text = lambda: text(x, y + fontsize, get_text(), font, fontsize=fontsize, upper=upper)
     self.read()
예제 #20
0
 def arrange_recent(self, x, y, linespacing):
     for i, recent in enumerate(self.recent):
         yield text(x, y + i * linespacing, recent, self.font)
예제 #21
0
 def __init__(self, width, name):
     self.k = 36
     self._label = text(24, self.k - 11, name, ISTYLES[('label',)])
예제 #22
0
 def store(self, value):
     self._value = int(value)
     self._state = self._value
     self._number  = text((self._anchors[0] + self._anchors[1])*0.5, self.k - 11, str(self._state), ISTYLES[('strong',)], align=0, sub_minus=True)
예제 #23
0
 def _stamp_glyphs(self, glyphs):
     font = ISTYLES[()]
     self._contents = text(self._text_left, font['fontsize'] + 5, glyphs, font, grid=True)
     self._template = self._contents[2]
     self._X_ = [g[1] for g in self._template]
     del self._X_[-1]
예제 #24
0
파일: splash.py 프로젝트: kelvin13/Knockout
 def arrange_recent(self, x, y, linespacing):
     for i, recent in enumerate(self.recent):
         yield text(x, y + i*linespacing, recent, self.font)
예제 #25
0
파일: kookies.py 프로젝트: moyogo/knockout
 def __init__(self, x, y, cellwidth, height, default, callback=None, signals=(), longstrings=None):
     Tabs.__init__(self, x, y, cellwidth, height, default, callback, signals)
     
     font = ISTYLES[('strong',)]
     self._state_labels = [text(x, self.y_bottom + 20, label, font, align=0) for label in longstrings]
예제 #26
0
파일: splash.py 프로젝트: kelvin13/Knockout
 def arrange_recent(self, x, y):
     linespacing = self.linespacing
     for i, recent in enumerate(self.recent):
         yield text(x, y + (i + 1)*linespacing, recent, self.font)
예제 #27
0
파일: menu.py 프로젝트: kelvin13/Knockout
 def _construct(self, font):
     # build menu
     x = self._x + 10
     y = self._y + font['fontsize'] + 5
     iht = self._item_height
     return (font['font'], font['fontsize']), [text(x, y + iht*i, signal[1], font) for i, signal in enumerate(self._signals)]