def __init__(self, w, minv, **kwargs): self.screen_size = get_min_screen_size() self.isMinimal = True if minv == 'minimal' else False self.root = w self.view = None self.story_view_size = None self.id = uuid() self.createView()
def __init__(self, w, minv): self.screen_size = get_min_screen_size() self.isMinimal = True if minv == "minimal" else False self.root = w self.view = None self.id = uuid() self.Scribbles = None self.TextFields = None self._name = None self._description = None self.story_view_size = None
if x == 0: b_col = d_txt.style['bg-color'] d_txt.style['bg-color'] = d_txt.style['border-color'] d_txt.style['border-color'] = b_col _del_list = [] for k in self.touch_positions.keys(): _points = self.touch_positions[k]['Cdata'] if not len(_points): _del_list.append(k) continue _colour = self.touch_positions[k]['Color'] if self.potential_deleted_lines == k: x = int(time.time()) % 2 if x == 0: _colour = DELETED_LINE else: self.touch_positions[k]['Color'] = RED set_color(*_colour) drawLine(_points) for k in _del_list: del self.touch_positions[k] if __name__ == '__main__': from pymt.ui.window import MTWindow from pymt.base import runTouchApp mw = MTWindow() mw.size = scale_tuple(get_min_screen_size(),.1) mw.add_widget(MyScribbleWidget(size= scale_tuple(mw.size,.3),pos=(100,100), cls='scribbleBordercss')) runTouchApp()
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
from cmap.controller.releaseController import ReleaseController from cmap.controller.basicControllers import ArtifactController from pymt.ui.widgets.button import MTToggleButton, MTButton from cmap.tools.my_buttons import MyImageButton from pymt.loader import Loader from pymt.ui.widgets.layout.gridlayout import MTGridLayout from pymt.utils import curry from cmap.view.stories.storyViews import pixels, minimal_size, StoryView, \ MinStoryView import os.path from cmap.gestures.myGestures import myGestures from cmap.gestures.NewGestures import get_and_or_store_gesture from pymt.ui.widgets.scatter import MTScatter from pymt.ui.colors import css_add_sheet from cmap.tools.capture import MyCaptureWidget size = get_min_screen_size() from cmap.tools.borders import MyInnerWindow from pymt.ui.window import MTWindow from pymt.base import runTouchApp, stopTouchApp from pygame.display import set_caption GestureCSS = ''' .gesturecss { bg-color: rgba(185,211,238, 255); border-color: rgb(100, 100, 220); border-width: 20; draw-border: 1; } ''' css_add_sheet(GestureCSS)