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
def add_to_git(self): AsyncHandler().save(None, 'Commit session edits') def container_reset_children(self,container): f = self.__getattribute__(container) x = len(f.children) -1 while x > 0: w = f.children[x] f.remove_widget(w) x = len(f.children) -1 @property def Artifacts(self): return self.artifacts if __name__ == '__main__': mw = MTWindow() mw.size = scale_tuple(size,0.045) scale = .13 size = scale_tuple(mw.size, scale) base_image = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..', 'examples', 'framework','images')) coverflow = MTCoverFlow(size=(500,500)) for fn in glob(os.path.join(base_image, '*.png')): button = MTToggleButton(label=os.path.basename(fn)) #MTImageButton(image=Loader.image(filename)) coverflow.add_widget(button) dc = MyDragableContainer(coverflow, True) mw.add_widget(dc) runTouchApp()
## if self.text_widget: # #keyboard = self.text_widget.keyboard # #self.text_widget.hide_keyboard() # self.ctrls_buttons_size = (self.ctrls_buttons_size[0],48) # self._keyboard.hide() # def save(self, touch=None): # if self._hidden: # print('about to show keyboard') # self.show_keyboard() # else: # print('about to hide keyboard') # self.hide_keyboard() # self._hidden = not self._hidden if __name__ == '__main__': w = MTWindow() w.size = (1800,980) # b = MyInnerWindow(size=(600,600), pos=(100,150), control_scale=0.7, \ # cls='type1css') # w.add_widget(b) # b = MTInnerWindow(size=(300,300), pos=(40,40), control_scale=0.7, \ # cls='type1css') # w.add_widget(b) # t = MyInnerWindowWithTrash(size=(300,300), pos=(300,425), \ # control_scale=0.7, cls='type1css') # w.add_widget(t) cw = MyInnerWindowWithSaveAndTrash(size=(600,600), pos=(100,100), control_scale=1, cls='type1css') #k = MTVKeyboard() #w.add_widget(k) # cw = MyInnerWindowWithKeyboard(size=(600,600), pos=(100,100), # control_scale=1, cls='type1css')
cls='innerwindow-close') b.my_padding = 12 b.push_handlers(on_release=trash) l.append(b) b = MTImageButton(filename=_save_icon_path, scale=1, cls='innerwindow-close') b.my_padding = 5 b.push_handlers(on_release=save) l.append(b) # b1.push_handlers('on_press', lambda x: x) c = Controls(None,l) return c if __name__ == '__main__': w = MTWindow() w.size = get_min_screen_size() #s = MTSlider(size=(500,500),pos=(150,150), cls='storycardcss') # ctrl = ProjectCtrl(w, story_parent=None) # s = ctrl.view # s = MTSlider(cls='storycardcss') s = newStory(w) #b = BorderWrap(s, pos=(190,190), size_scaler=(-.2,-.3))#, cls='borderwrapcss') #b.pos = (200,200) #c= MTScatter(size=(250,250), pos=(400,400),cls='storycardcss') c = getControls() # w.add_widget(c) b = Border2(s, ctrls=c,pos=(190,190), size_scaler=(-.2,-.35)) w.add_widget(b) runTouchApp()