def __init__(self, **kwargs): super(MTFileListEntryView, self).__init__(**kwargs) self.height = 25 self.image = Loader.image(self.type_image) self.image.scale = 0.5 if self.browser._w_limit is None: self.browser.w_limit = 1 self.font_size = self.style['font-size']
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')
def main(): global Log # This must be done BEFORE trying to import any PYMT stuff since PyMT # messes with the arguments from agileConfig import AgiConfig config = AgiConfig(Log) if config.noDatastore: Log.critical('No data store defined or accessible') sys.exit(2) if config.pymtUnavailable: Log.critical('PyMT is not available') sys.exit(2) if config.args.loglevel: Log.level = config.args.loglevel from agileConfig import AsyncHandler from pymt.ui.window import MTWindow from pymt.base import runTouchApp, stopTouchApp from cmap.controller.storyapp import StoryApp from cmap.tools.myTools import get_min_screen_size, scale_tuple from cmap.view.stories.storyViews import TestController import os Log.debug('current directory: %s' % os.path.abspath(os.path.curdir)) if config.args.startdir: os.chdir(config.args.startdir) Log.debug('current directory: %s' % os.path.abspath(os.path.curdir)) # Get the PyMT window w = MTWindow() b = None try: if config.args.storycard: if config.args.storycard == 'flow': from pymt.ui.widgets.coverflow import MTCoverFlow from glob import glob from pymt.ui.widgets.button import MTImageButton from pymt.loader import Loader base_image = os.path.join(os.path.dirname(__file__),'examples', 'framework','images') coverflow = MTCoverFlow(size=w.size) for filename in glob(os.path.join(base_image, '*.png')): button = MTImageButton(image=Loader.image(filename)) button.title = os.path.basename(filename) coverflow.add_widget(button) runTouchApp(coverflow) return else: Log.debug('Testing stories only...') b = TestController(w, config.args.storycard) elif not config.args.fullscreen: Log.debug('Running in non fullscreen mode...') #Setup our application window size = get_min_screen_size() w.size = scale_tuple(size,0.045) scale = .13 size = scale_tuple(w.size, scale) pos = (w.size[0] - (size[0] +55), w.size[1] - (size[1] +35)) b = StoryApp(root_window=w,size=size, pos=pos, control_scale=0.7) else: Log.debug('Fullscreen mode...') b = StoryApp(root_window=w,size=w.size, pos=(0,0), control_scale=0.7) w.add_widget(b) b.fullscreen() # Run the application Log.debug("About to run CMAP") runTouchApp() b.close(None) Log.debug('CMAP normal exit') return except Exception: Log.exception('Exception causing premature CMAP exit') # We need to make sure that everything shuts down cleanly stopTouchApp() if AsyncHandler() is not None: AsyncHandler().shutdown() Log.debug('CMAP exception exit') raise
def __init__(self, **kwargs): super(MTFileIconEntryView, self).__init__(**kwargs) self.size = (80, 80) self.image = Loader.image(self.type_image) if self.browser._w_limit is None: self.browser.w_limit = 4
def __init__(self, **kwargs): global _storyapp_singleton #IGNORE:W0603 # Make ourself globally known _storyapp_singleton = self super(StoryApp, self).__init__(**kwargs) set_caption("Collaborative Multitouch Agile Planner") AsyncHandler().set_handler(ON_GITHUBNOTIFICATION, self.on_github_notification) self.no_local_repo = Config().localRepoNotAvailable if not self.no_local_repo: AsyncHandler().save([], 'Cleanup any outstanding uncommitted edits') self.root_window = kwargs['root_window'] self.canvas = None self.backlog_list_layout = MTGridLayout(rows=1) self._x_range = range(self.root_window.x, self.root_window.x + \ self.root_window.width - minimal_size[0]) self._y_range = range(self.root_window.y, self.root_window.y + \ self.root_window.height - minimal_size[1]) self.main_ctlrs_container = MTSidePanel(\ corner=MTToggleButton(padding=5, label='File...', size=(60,45)), layout=MTGridLayout(rows=1), align='left', side='top') self.backlog_container = MTSidePanel(\ corner=MTToggleButton(padding=5, label='Backlog...', size=(100,45)), align='middle', side='bottom', pos=(0,self.root_window.height-100)) self.buttons = {} self.labels = {} self.backlog = {} self.artifacts = {} self.story_files = [] self.tasks = {} self.backlog_flow_open = True self.projects_flow_open = True self.releases_flow_open = True self.story_flow_open = True self.sprint_flow_open = True self.task_flow_open = True self.current_backlog = None self.current_project = None self.current_release = None self.current_sprint = None self.current_story = None self.current_task = None self.currentProjectView = None self.currentReleaseView = None self.currentSprintView = None self.currentStoryView = None self.currentTaskView = None self.checked_for_releases = False self.checked_for_sprints = False self.checked_for_stories = False self.checked_for_tasks = False # Load the default image for buttons and cover flows path = os.path.join(os.getcwd(), 'data', 'ModelScribble.jpg') self._default_button_size = (100, 100) self._default_image = Loader.image(path) _sf_pos = (200,200) try: self.backlog_flow = MTCoverFlow( layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.backlog_flow.push_handlers(on_select=self.flow_backlog_select) self.backlog_flow.add_widget(self.createNewStoryButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create backlog cover flow") self.backlog_flow = MTGridLayout(rows=1, pos=_sf_pos) self.backlog_flow.add_widget(self.createNewStoryButton()) try: self.projects_flow = MTCoverFlow(\ layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.projects_flow.push_handlers(\ on_select=self.flow_projects_select) self.projects_flow.add_widget(self.createNewProjectButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create project cover flow") self.projects_flow = MTGridLayout(rows=1, pos=_sf_pos) try: self.release_flow = MTCoverFlow(\ layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.release_flow.push_handlers(\ on_select=self.flow_release_select) self.release_flow.add_widget(self.createNewReleaseButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create release cover flow") self.release_flow = MTGridLayout(rows=1, pos=_sf_pos) try: self.sprint_flow = MTCoverFlow(\ layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.sprint_flow.push_handlers(\ on_select=self.flow_sprint_select) self.sprint_flow.add_widget(self.createNewSprintButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create sprint cover flow") self.sprint_flow = MTGridLayout(rows=1, pos=_sf_pos) try: self.story_flow = MTCoverFlow(\ layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.story_flow.push_handlers(on_select=self.flow_story_select) self.story_flow.add_widget(self.createNewStoryButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create story cover flow") self.story_flow = MTGridLayout(rows=1, pos=_sf_pos) try: self.task_flow = MTCoverFlow(\ layout=MTGridLayout(spacing=10,rows=1), pos=_sf_pos, size=self._default_button_size, cover_spacing=20, cover_distance=115, thumbnail_size=self._default_button_size) self.task_flow.push_handlers(on_select=self.flow_task_select) self.task_flow.add_widget(self.createNewTaskButton()) except Exception: #IGNORE:W0703 Log.exception("Unable to create task coverflow") self.task_flow = MTGridLayout(rows=1, pos=_sf_pos) #dragable containers for the flow objects so we can move them around #the screen self.dragable_backlog_flow = MyDragableContainer(self.backlog_flow, True, size_scaler=(-.1,-.1), cls='dragcss', use_widget_size=False) self.dragable_project_flow = MyDragableContainer(self.projects_flow, True, size_scaler=(-.2,-.2), cls='dragcss') self.dragable_release_flow = MyDragableContainer(self.release_flow, True, size_scaler=(-.2,-.2), cls='dragcss') self.dragable_sprint_flow = MyDragableContainer(self.sprint_flow, True, size_scaler=(-.2,-.2), cls='dragcss') self.dragable_story_flow = MyDragableContainer(self.story_flow, True, size_scaler=(-.2,-.2), cls='dragcss') self.dragable_task_flow = MyDragableContainer(self.task_flow, True) self.backlog_list = MTList(size=(self.root_window.width,100),pos=(0,0)) self.backlog_list.add_widget(self.backlog_list_layout) self.backlog_container.add_widget(self.backlog_list) self.path = Config().datastore Log.debug('Path to repository: %s' % self.path) #enable gesture detection self.enable_gestures() self.canvas.add_widget(self.backlog_container) self.addMainControls() self.xmlFiles = self.get_local_artifacts() self.load_backlog() self.load_projects() #make sure no projects or stories are set as the current ones self.current_project = None self.current_story = None