예제 #1
0
파일: scrible.py 프로젝트: estemenson/CMAP
 def drawTextInput(self,touch):
     start, pos = self.touch_time[touch.id]
     start = start if start else time.time() 
     elaspsed_time = time.time() -  start
     idu = self.touch_keys[touch.id]
     Log.debug('Elapsed time:%s' % elaspsed_time)
     if elaspsed_time >= 1:
         distance = Vector.distance( Vector(pos.sx, pos.sy),
                                     Vector(touch.osxpos, touch.osypos))
         Log.debug('Screen coordinate Distance:%f vs %f' % (distance,self.press_and_hold_distance))
         _l = len(self.touch_positions[idu]['Cdata'])
         Log.debug('Num points:%d' % _l)
         _vd = Vector.distance(\
                         Vector(*self.touch_positions[idu]['Cdata'][0]),\
                         Vector(*self.touch_positions[idu]['Cdata'][_l-1]))
         Log.debug('touch distance :%f and %d' % (_vd, int(_vd)))
         if distance <= self.press_and_hold_distance and\
                     (_l < self.travel_limit or int(_vd) < self.travel_limit):                                            
             
             txt = ScribbleTextWidget(pos=touch.pos, group=self.session,
                                                keyboard=self.keyboard,
                                                cls='scribbleKeyboardcss')
             txt.push_handlers(on_transform=curry(self.on_transform,txt))
             self.add_widget(txt) 
             self.disable_all()
             txt.enable()
             d = txt.to_dic()
             self.dispatch_event('on_text_change', d)
             return True
예제 #2
0
파일: popup.py 프로젝트: Markitox/pymt
    def __init__(self, **kwargs):
        kwargs.setdefault('do_scale', False)
        kwargs.setdefault('size', (400, 400))
        kwargs.setdefault('show_cancel', True)
        kwargs.setdefault('label_cancel', 'Cancel')
        kwargs.setdefault('label_submit', 'Ok')
        kwargs.setdefault('title', 'PyMT popup')
        kwargs.setdefault('exit_on_submit', True)
        super(MTPopup, self).__init__(**kwargs)

        self.register_event_type('on_submit')
        self.register_event_type('on_cancel')

        self.exit_on_submit = kwargs.get('exit_on_submit')

        # Create layouts
        self.layout = MTBoxLayout(size=self.size,  orientation='vertical')
        self.l_content = MTBoxLayout(orientation='vertical')
        self.l_buttons = MTBoxLayout(size_hint=(1, None),
                                     orientation='horizontal')

        # Titles
        if kwargs.get('title'):
            self.w_title = MTLabel(label=kwargs.get('title'),
                                   autosize=True, cls='popup-title')

        # Buttons
        self.w_submit = MTButton(label=kwargs.get('label_submit'),
                                 size_hint=(0.5, None), height=40,
                                 cls='popup-button')
        self.w_submit.push_handlers(on_release=curry(
            self._dispatch_event, 'on_submit'))
        self.l_buttons.add_widget(self.w_submit)
        if kwargs.get('show_cancel'):
            self.w_cancel = MTButton(label=kwargs.get('label_cancel'),
                                     size_hint=(0.5, None), height=40,
                                     cls='popup-button')
            self.w_cancel.push_handlers(on_release=curry(
                self._dispatch_event, 'on_cancel'))
            self.l_buttons.add_widget(self.w_cancel)

        # Connect
        if kwargs.get('title'):
            self.layout.add_widget(self.w_title)
        self.layout.add_widget(self.l_content)
        self.layout.add_widget(self.l_buttons)
        super(MTPopup, self).add_widget(self.layout)
예제 #3
0
    def __init__(self, **kwargs):
        kwargs.setdefault('title', 'Open a file')
        kwargs.setdefault('label_submit', 'Open')
        kwargs.setdefault('size', (350, 500))
        kwargs.setdefault('filters', [])
        kwargs.setdefault('multipleselection', False)
        kwargs.setdefault('view', MTFileIconEntryView)
        kwargs.setdefault('invert_order', False)
        kwargs.setdefault('show_toggles', True)
        super(MTFileBrowser, self).__init__(**kwargs)

        self.register_event_type('on_select')

        # Title
        self.w_path = MTLabel(label='.',
                              autoheight=True,
                              size=(self.width, 30),
                              color=(.7, .7, .7, .5))
        #self.add_widget(self.w_path)

        # File View
        self.view = MTFileBrowserView(
            size_hint=(1, 1),
            filters=kwargs.get('filters'),
            multipleselection=kwargs.get('multipleselection'),
            view=kwargs.get('view'),
            invert_order=kwargs.get('invert_order'))
        self.view.push_handlers(on_path_change=self._on_path_change)
        self.add_widget(self.view, True)

        # Update listing
        self.view.path = '.'

        # Show hidden files
        if kwargs['show_toggles']:
            self.w_hiddenfile = MTFileBrowserToggle(
                icon='filebrowser-hidden.png', size=(40, 40))
            self.w_hiddenfile.push_handlers(
                on_press=curry(self._toggle_hidden, self.w_hiddenfile))
            self.l_buttons.add_widget(self.w_hiddenfile)

            # Select view
            self.w_view = MTFileBrowserToggle(icon='filebrowser-iconview.png',
                                              size=(40, 40))
            self.w_view.push_handlers(
                on_press=curry(self._toggle_view, self.w_view))
            self.l_buttons.add_widget(self.w_view, True)
예제 #4
0
 def add_widget(self, widget, tab_name=None):
     if tab_name:
         tab_btn = self.new_tab(tab_name)
         tab_btn.push_handlers(on_press=curry(self.select, widget))
         self.tabs.add_widget(tab_btn)
         if widget.id is None:
             widget.id = tab_name
     self.screens.append(widget)
예제 #5
0
 def add_widget(self, widget, tab_name=None):
     if tab_name:
         tab_btn = self.new_tab(tab_name)
         tab_btn.push_handlers(on_press=curry(self.select, widget))
         self.tabs.add_widget(tab_btn)
         if widget.id is None:
             widget.id = tab_name
     self.screens.append(widget)
예제 #6
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def add_new_artifact(self, ctrl, container, callback, ret):
     for c in container:
         _lbl = MyImageButton(id=ctrl.Id, size=self._default_button_size,
                              image=self._default_image)
         self.check_btn_width(_lbl)
         _lbl.push_handlers(on_press=curry(self.__getattribute__(callback), 
                                                                     _lbl))
         self.__getattribute__(c).add_widget(_lbl)
         ret[c] = _lbl
     return ret
예제 #7
0
파일: tabs.py 프로젝트: gavine199/pymt
 def add_widget(self, widget, tab=None):
     if tab is None:
         if not hasattr(widget, 'tab'):
             raise Exception('Widget added without tab information')
         else:
             tab = widget.tab
     button = MTButton(label=tab, size=(120, 40))
     button.tab_container = self
     button.connect('on_release', curry(self.select, tab))
     self.topbar.add_widget(button)
     self.tabs[tab] = (button, widget)
예제 #8
0
파일: tabs.py 프로젝트: Markitox/pymt
 def add_widget(self, widget, tab=None):
     if tab is None:
         if not hasattr(widget, 'tab'):
             raise Exception('Widget added without tab information')
         else:
             tab = widget.tab
     button = MTButton(label=tab, size=(120, 40))
     button.tab_container = self
     button.connect('on_release', curry(self.select, tab))
     self.topbar.add_widget(button)
     self.tabs[tab] = (button, widget)
예제 #9
0
    def __init__(self, **kwargs):
        kwargs.setdefault('title', 'Open a file')
        kwargs.setdefault('label_submit', 'Open')
        kwargs.setdefault('size', (350, 500))
        kwargs.setdefault('filters', [])
        kwargs.setdefault('multipleselection', False)
        kwargs.setdefault('view', MTFileIconEntryView)
        kwargs.setdefault('invert_order', False)
        kwargs.setdefault('show_toggles', True)
        super(MTFileBrowser, self).__init__(**kwargs)

        self.register_event_type('on_select')

        # Title
        self.w_path = MTLabel(label='.', autoheight=True, size=(self.width, 30),
                              color=(.7, .7, .7, .5))
        #self.add_widget(self.w_path)

        # File View
        self.view = MTFileBrowserView(size_hint=(1, 1), filters=kwargs.get('filters'),
                multipleselection=kwargs.get('multipleselection'), view=kwargs.get('view'),
                invert_order=kwargs.get('invert_order'))
        self.view.push_handlers(on_path_change=self._on_path_change)
        self.add_widget(self.view, True)

        # Update listing
        self.view.path = '.'

        # Show hidden files
        if kwargs['show_toggles']:
            self.w_hiddenfile = MTFileBrowserToggle(icon='filebrowser-hidden.png', size=(40, 40))
            self.w_hiddenfile.push_handlers(on_press=curry(self._toggle_hidden, self.w_hiddenfile))
            self.l_buttons.add_widget(self.w_hiddenfile)

            # Select view
            self.w_view = MTFileBrowserToggle(icon='filebrowser-iconview.png', size=(40, 40))
            self.w_view.push_handlers(on_press=curry(self._toggle_view, self.w_view))
            self.l_buttons.add_widget(self.w_view, True)
예제 #10
0
    def process(self, events):
        #print "InputPostprocTouchAndHold::process"
        if len(self.queue):
            events = self.queue + events
            self.queue = []

        schedule = getClock().schedule_once
        unschedule = getClock().unschedule
        for type, touch in events:
            if type == 'down':
                touch.userdata['touchandhold.func'] = curry(self._timeout, touch)
                schedule(touch.userdata['touchandhold.func'], self.hold_time)
            elif type == 'up':
                unschedule(touch.userdata['touchandhold.func'])
        return events
예제 #11
0
    def update(self):
        '''Update the content of view. You must call this function after
        any change of a property. (except path.)'''
        # remove all actual entries
        self.clear()
        self.selection = []

        children = []
        listfiles = os.listdir(self.path)
        listfiles.sort()

        # add each file from directory
        # only files are filtred with filters
        for name in reversed(listfiles):
            filename = os.path.join(self.path, name)

            # filter on hidden file if requested
            if not self.show_hidden:
                if name != '..' and name[0] == '.':
                    continue

            if os.path.isdir(filename):
                continue

            # filtering
            if len(self.filters):
                match = False
                for regex in self.filters:
                    if re.match(regex, name):
                        match = True
                if not match:
                    continue

            # add this file as new file.
            children.append(
                self.view(label=name,
                          filename=filename,
                          browser=self,
                          size=self.size))

        # second time, do directories
        for name in reversed(listfiles):
            filename = os.path.join(self.path, name)

            # filter on hidden file if requested
            if not self.show_hidden:
                if name != '..' and name[0] == '.':
                    continue

            if not os.path.isdir(filename):
                continue

            # add this file as new file.
            children.append(
                self.view(label=name,
                          filename=filename,
                          browser=self,
                          size=self.size))

        # add always "to parent"
        children.append(
            self.view(label='..',
                      filename=os.path.join(self.path, '../'),
                      browser=self,
                      size=self.size))

        # attach handlers
        for child in children:
            child.push_handlers(on_press=curry(self._on_file_selected, child))
            self.add_widget(child, front=self.invert_order)
예제 #12
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewProjectButton(self):
     return self.create_button(LABEL_NEW_PROJECT,curry(\
                                                 self.new_project_pressed))
예제 #13
0
파일: vkeyboard.py 프로젝트: Markitox/pymt
    def __init__(self, **kwargs):
        kwargs.setdefault('size', MTVKeyboard.DEFAULT_SIZE)
        kwargs.setdefault('pos', MTVKeyboard.DEFAULT_POS)
        kwargs.setdefault('layout', None)
        kwargs.setdefault('time_lazy_update', .2)
        kwargs.setdefault('repeat', 1 / 15.)
        kwargs.setdefault('repeat_timeout', .2)

        self._old_scale = 0

        super(MTVKeyboard, self).__init__(**kwargs)

        self.register_event_type('on_key_down')
        self.register_event_type('on_key_up')
        self.register_event_type('on_text_change')

        self.time_lazy_update   = kwargs.get('time_lazy_update')
        self.layout             = kwargs.get('layout')
        self.container_width, self.container_height   = self.size
        self.repeat             = kwargs.get('repeat')
        self.repeat_timeout     = kwargs.get('repeat_timeout')

        # read default layout in configuration
        if self.layout is None:
            idlayout = pymt.pymt_config.get('keyboard', 'layout')
            # search layout
            for layout in MTVKeyboard.available_layout:
                if layout.ID == idlayout:
                    self.layout = layout()
                    break
            # no layout found ?
            if self.layout is None:
                pymt.pymt_logger.warning('Vkeyboard: Keyboard layout <%s> not found, fallback on QWERTY' % idlayout)
                self.layout = KeyboardLayoutQWERTY()

        self._mode              = 'NORMAL'
        self._cache             = {}
        self._current_cache     = None
        self._last_update       = 0
        self._last_update_scale = 1.
        self._need_update       = 'now'
        self._internal_text     = u''
        self._show_layout       = False
        self._active_keys       = []
        self._used_label        = []
        self._last_key_down     = []
        self._last_key_repeat   = 0
        self._last_key_repeat_timeout  = 0

        # prepare layout widget
        mtop, mright, mbottom, mleft = self.style['margin']
        self._layout_widget     = MTKineticList(
            title=None, searchable=False, deletable=False,
            size=(self.width - mleft - mright, self.height),
            pos=(mleft, 0), style={'bg-color': (.0, .0, .0, .7)},
            visible=False)
        for layout in MTVKeyboard.available_layout:
            item = MTKineticItem(label=layout.TITLE + ' - ' + layout.DESCRIPTION,
                    style={'font-size':14}, size=(self.width - mleft - mright, 40))
            item.push_handlers(on_press=curry(self.on_layout_change, layout))
            self._layout_widget.add_widget(item)
        self.add_widget(self._layout_widget)
예제 #14
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewReleaseButton(self):
     return self.create_button(LABEL_NEW_RELEASE,curry(\
                                                 self.new_release_pressed))
예제 #15
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewSprintButton(self):
     return self.create_button(LABEL_NEW_SPRINT, curry(\
                                                 self.new_sprint_pressed))
예제 #16
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewTaskButton(self):
     return self.create_button(LABEL_NEW_TASK,curry(self.new_task_pressed))
예제 #17
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewStoryButton(self):
     return self.create_button(LABEL_NEW_STORY,curry(self.new_story_pressed))
예제 #18
0
파일: vkeyboard.py 프로젝트: gavine199/pymt
    def __init__(self, **kwargs):
        kwargs.setdefault('size', MTVKeyboard.DEFAULT_SIZE)
        kwargs.setdefault('pos', MTVKeyboard.DEFAULT_POS)
        kwargs.setdefault('layout', None)
        kwargs.setdefault('time_lazy_update', .2)
        kwargs.setdefault('repeat', 1 / 15.)
        kwargs.setdefault('repeat_timeout', .2)

        self._old_scale = 0

        super(MTVKeyboard, self).__init__(**kwargs)

        self.register_event_type('on_key_down')
        self.register_event_type('on_key_up')
        self.register_event_type('on_text_change')

        self.time_lazy_update   = kwargs.get('time_lazy_update')
        self.layout             = kwargs.get('layout')
        self.container_width, self.container_height   = self.size
        self.repeat             = kwargs.get('repeat')
        self.repeat_timeout     = kwargs.get('repeat_timeout')

        # read default layout in configuration
        if self.layout is None:
            idlayout = pymt.pymt_config.get('keyboard', 'layout')
            # search layout
            for layout in MTVKeyboard.available_layout:
                if layout.ID == idlayout:
                    self.layout = layout()
                    break
            # no layout found ?
            if self.layout is None:
                pymt.pymt_logger.warning('Vkeyboard: Keyboard layout <%s> not found, fallback on QWERTY' % idlayout)
                self.layout = KeyboardLayoutQWERTY()

        self._mode              = 'NORMAL'
        self._cache             = {}
        self._current_cache     = None
        self._last_update       = 0
        self._last_update_scale = 1.
        self._need_update       = 'now'
        self._internal_text     = u''
        self._show_layout       = False
        self._active_keys       = []
        self._used_label        = []
        self._last_key_down     = []
        self._last_key_repeat   = 0
        self._last_key_repeat_timeout  = 0

        # prepare layout widget
        mtop, mright, mbottom, mleft = self.style['margin']
        self._layout_widget     = MTKineticList(
            title=None, searchable=False, deletable=False,
            size=(self.width - mleft - mright, self.height),
            pos=(mleft, 0), style={'bg-color': (.0, .0, .0, .7)},
            visible=False)
        for layout in MTVKeyboard.available_layout:
            item = MTKineticItem(label=layout.TITLE + ' - ' + layout.DESCRIPTION,
                    style={'font-size':14}, size=(self.width - mleft - mright, 40))
            item.push_handlers(on_press=curry(self.on_layout_change, layout))
            self._layout_widget.add_widget(item)
        self.add_widget(self._layout_widget)
예제 #19
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewBacklogFlowButton(self):
     return self.create_button('Browse\nBacklog...',
                               curry(self._flow_pressed,\
                     'backlog_flow_open',self.dragable_backlog_flow))
예제 #20
0
 def _add_suggestion(self, word):
     k = {'autoheight': True, 'font_size': 16}
     label = MTSpellVKeyboardLabel(label=' %s ' % word, **k)
     label.connect('on_press', curry(self._press_suggestion, word))
     self.slayout.add_widget(label)
예제 #21
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewProjectFlowButton(self):
     return self.create_button('Browse\nProjects...',\
                               curry(self._flow_pressed,\
                     'projects_flow_open',self.dragable_project_flow))
예제 #22
0
파일: filebrowser.py 프로젝트: bernt/pymt
    def update(self):
        '''Update the content of view. You must call this function after
        any change of a property. (except path.)'''
        # remove all actual entries
        self.clear()
        self.selection = []

        children = []
        listfiles = os.listdir(self.path)
        listfiles.sort()

        # add each file from directory
        # only files are filtred with filters
        for name in reversed(listfiles):
            filename = os.path.join(self.path, name)

            # filter on hidden file if requested
            if not self.show_hidden:
                if name != '..' and name[0] == '.':
                    continue

            if os.path.isdir(filename):
                continue

            # filtering
            if len(self.filters):
                match = False
                for filter in self.filters:
                    if re.match(filter, name):
                        match = True
                if not match:
                    continue

            # add this file as new file.
            children.append(self.view(
                label=name, filename=filename,
                browser=self, size=self.size
            ))

        # second time, do directories
        for name in reversed(listfiles):
            filename = os.path.join(self.path, name)

            # filter on hidden file if requested
            if not self.show_hidden:
                if name != '..' and name[0] == '.':
                    continue

            if not os.path.isdir(filename):
                continue

            # add this file as new file.
            children.append(self.view(
                label=name, filename=filename,
                browser=self, size=self.size
            ))

        # add always "to parent"
        children.append(self.view(
            label='..', filename=os.path.join(self.path, '../'),
            browser=self, size=self.size
        ))

        # attach handlers
        for child in children:
            child.push_handlers(on_press=curry(self._on_file_selected, child))
            self.add_widget(child, front=self.invert_order)
예제 #23
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewReleasesFlowButton(self):
     return self.create_button('Browse\nReleases...',
                               curry(self._flow_pressed,\
                     'releases_flow_open',self.dragable_release_flow))
예제 #24
0
    def __init__(self, **kwargs):
        kwargs.setdefault("size", MTVKeyboard.DEFAULT_SIZE)
        kwargs.setdefault("pos", MTVKeyboard.DEFAULT_POS)
        kwargs.setdefault("layout", None)
        kwargs.setdefault("time_lazy_update", 0.2)
        kwargs.setdefault("repeat", 1 / 15.0)
        kwargs.setdefault("repeat_timeout", 0.2)

        self._old_scale = 0

        super(MTVKeyboard, self).__init__(**kwargs)

        self.register_event_type("on_key_down")
        self.register_event_type("on_key_up")
        self.register_event_type("on_text_change")

        self.time_lazy_update = kwargs.get("time_lazy_update")
        self.layout = kwargs.get("layout")
        self.container_width, self.container_height = self.size
        self.repeat = kwargs.get("repeat")
        self.repeat_timeout = kwargs.get("repeat_timeout")

        # read default layout in configuration
        if self.layout is None:
            idlayout = pymt.pymt_config.get("keyboard", "layout")
            # search layout
            for layout in MTVKeyboard.available_layout:
                if layout.ID == idlayout:
                    self.layout = layout()
                    break
            # no layout found ?
            if self.layout is None:
                pymt.pymt_logger.warning("Vkeyboard: Keyboard layout <%s> not found, fallback on QWERTY" % idlayout)
                self.layout = KeyboardLayoutQWERTY()

        self._mode = "NORMAL"
        self._cache = {}
        self._current_cache = None
        self._last_update = 0
        self._last_update_scale = 1.0
        self._need_update = "now"
        self._internal_text = u""
        self._show_layout = False
        self._active_keys = []
        self._used_label = []
        self._last_key_down = []
        self._last_key_repeat = 0
        self._last_key_repeat_timeout = 0

        # prepare layout widget
        mtop, mright, mbottom, mleft = self.style["margin"]
        self._layout_widget = MTKineticList(
            title=None,
            searchable=False,
            deletable=False,
            size=(self.width - mleft - mright, self.height),
            pos=(mleft, 0),
            style={"bg-color": (0.0, 0.0, 0.0, 0.7)},
            visible=False,
        )
        for layout in MTVKeyboard.available_layout:
            item = MTKineticItem(
                label=layout.TITLE + " - " + layout.DESCRIPTION,
                style={"font-size": 14},
                size=(self.width - mleft - mright, 40),
            )
            item.push_handlers(on_press=curry(self.on_layout_change, layout))
            self._layout_widget.add_widget(item)
        self.add_widget(self._layout_widget)
예제 #25
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewSprintFlowButton(self):
     return self.create_button('Browse\nSprints...',
                               curry(self._flow_pressed,\
                     'sprint_flow_open',self.dragable_sprint_flow))
예제 #26
0
파일: scrible.py 프로젝트: estemenson/CMAP
 def __init__(self, **kwargs):
     kwargs.setdefault('cls', 'scribbleBordercss')
     super(MyScribbleWidget,self).__init__(**kwargs)
     self.session = uuid()
     self.is_pen_active = True
     self.sessions = kwargs.setdefault('sessions',{self.session:{}})
     self.press_and_hold_distance = \
         kwargs.setdefault('activate_keyboard_distance',10 /1000.0)
     self.delete_distance = kwargs.setdefault('delete_distance',12)
     self.potential_deleted_lines  = None
     self.potential_deleted_text  = None
     self.touch_time = {}
     self.old_touches = {}
     self.old_colors = {}
     self.touch_positions = {}
     self.touch_keys = {}
     self.touch_positions = kwargs.get('scribbles',{})
     self.travel_limit = 5
     self.keyboard = MTVKeyboard()
     tf = kwargs.get('TextFields', {})
     if tf:
         args = {'group':self.session,
                 'keyboard':self.keyboard,
                 'cls':'scribbleKeyboardcss'}
         for txt in tf.values():
             # we need to create and add the following textfields
             args['Id']=txt['Id'] 
             args['pos']=eval(txt['pos'])
             args['size']=eval(txt['size'])
             args['color']=txt['Color']
             args['font-size']=eval(txt['Font-Size'])
             args['label']=txt['Cdata']
             stw = ScribbleTextWidget(**args) #IGNORE:W0142
             stw.push_handlers(on_transform=curry(self.on_transform,stw))
             self.add_widget(stw)
     self.ctrls_container = MySidePanel(layout=MTGridLayout(cols=1),
                                        use_root=False,#duration=0.1,
                                     corner=MTImageButton(padding=5,
                             image=Loader.image(OPEN_SIDE_ICON),
                                                     size=(48,48)),
                                     corner_open=MTImageButton(padding=5,
                             image=Loader.image(CLOSE_SIDE_ICON),
                                                     size=(48,48)),
                                     align='middle',
                                     side='right',
                                     pos=(0,0),cls='mybtn')
     btn_pen = MTImageButton(padding=5,image=Loader.image(PEN_ICON))
     btn_pen.connect('on_press', self.pen)
     self.ctrls_container.add_widget(btn_pen)
     btn_erase = MTImageButton(padding=5,image=Loader.image(ERASER_ICON))
     btn_erase.connect('on_press', self.eraser)
     self.ctrls_container.add_widget(btn_erase)
     btn_color = MTImageButton(padding=5,image=Loader.image(COLOR_ICON))
     btn_color.connect('on_press', self.color)
     self.ctrls_container.add_widget(btn_color)
     self.add_widget(self.ctrls_container)
     self.current_color = DEFAULT_COLOR
     self.bg_color = self.style['bg-color']
     self.new_color = None
     self.border_color = self.style['border-color']
     self.border_width = self.style['border-width']
     self.register_event_type('on_change')
     self.register_event_type('on_text_change')
예제 #27
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewStoryFlowButton(self):
     return self.create_button('Browse\nStories...', 
         curry(self._flow_pressed,\
                     'story_flow_open',self.dragable_story_flow))
예제 #28
0
파일: storyapp.py 프로젝트: estemenson/CMAP
 def createNewTaskFlowButton(self):
     return self.create_button('Browse\nTasks...',
                               curry(self._flow_pressed,\
                     'task_flow_open',self.dragable_task_flow))
예제 #29
0
 def _add_suggestion(self, word):
     k = {'autoheight': True, 'font_size': 16}
     label = MTSpellVKeyboardLabel(label=' %s ' % word, **k)
     label.connect('on_press', curry(self._press_suggestion, word))
     self.slayout.add_widget(label)