def paintLists( self, rec_slice=None, line_slice=None ): # Draw to back buffer items in the lists self.paintText() if self._reverseDrawOrder: self.rec_list.reverse() # darwin wants front to back drawing order self.line_list.reverse() else: self.doHUD() self.paintText() # Determine slice of lists to use - Experimental _r_slice, _l_slice = None, None if rec_slice==None: _r_slice = slice( 0, len(self.rec_list), None ) else: _r_slice = slice( rec_slice[0], rec_slice[1], None ) if line_slice==None: _l_slice = slice( 0, len(self.line_list), None ) else: _l_slice = slice( line_slice[0], line_slice[1], None ) for task in self._draw_order: if task == "RECTS": for (x, y, w, h, col, mode) in self.rec_list[_r_slice]: self.drawRect2D( x, y, w, h, CT.web23f( col ), mode ) elif task == "LINES": for (x, y, m, n, col) in self.line_list[_l_slice]: self.drawLine2D( x, y, m, n, CT.web23f( col ) ) if self._reverseDrawOrder: self.doHUD() self.paintText()
def init(self): # super super(ViewTest, self).init() # set coloura self._bg = CT.web24f(self.COLOURS["BACK"][0]) self._hud_man.addMsg("LOG", "Booting...", CT.web23f("#0000FF")) # my Vars # timing now = time.time() tmp_time = DT.datetime.fromtimestamp(now) log_time = DT.datetime(tmp_time.year, tmp_time.month, tmp_time.day, 0, 0, 0, 0) self._epoch = CR.timegm(log_time.timetuple()) del (tmp_time, log_time, now) self.now = time.time() - self._epoch # Register keys / Callback into the key_man # clean exit self._key_man.registerFallingCB(27, self.end) # set up Messages self._hud_man.addElement("MSG", self._wh[0] - 200, self._wh[1] - 10, CT.web23f("#FFFFFF"), -1) self._hud_man.addMsg("LOG", "Ready!")
def _advanceTake(self): if not self.recording: self.take_no += 1 retort = "Take: BlarBlar_AA_AA_{:0>3}".format(self.take_no) self._hud_man.addMsg("LOG", "Advance", CT.web23f("#00FF00")) self._hud_man.addMsg("MSG", retort) else: self.HUD_msg = "Can't advance when recording"
def init( self ): # do glut init # TODO: refactor to freeglut glutInit() glutInitDisplayMode( self._glut_opts ) # Get Natove res self._native_wh = (glutGet( GLUT_SCREEN_WIDTH ), glutGet( GLUT_SCREEN_HEIGHT )) # Guard against requested window size > native new_wh = list( self._wh ) new_wh[0] = min( self._wh[0], self._native_wh[0] ) new_wh[1] = min( self._wh[1], self._native_wh[1] ) self._wh = tuple( new_wh ) # auto center if self._center: pos_x = (self._native_wh[0]-self._wh[0]) / 2 pos_y = (self._native_wh[1]-self._wh[1]) / 2 self._native_pos = (pos_x, pos_y) glutInitWindowSize( self._wh[0], self._wh[1] ) glutInitWindowPosition( self._native_pos[0], self._native_pos[1] ) self.g_wind = glutCreateWindow( self._title ) # Enable GL Options glShadeModel(GL_SMOOTH) glEnable(GL_CULL_FACE) glEnable(GL_DEPTH_TEST) #glEnable(GL_LIGHTING) glDepthFunc(GL_LESS) # bind std CBs # This only works because we're interpreted, and this function is called # after the object is constructed, and the derived method has superceeded # it's prototype. glutDisplayFunc( self._draw ) glutIdleFunc( self._idle ) glutReshapeFunc( self._reSize ) # keys glutIgnoreKeyRepeat( 1 ) glutKeyboardFunc( self._keyDn ) glutKeyboardUpFunc( self._keyUp ) glutSpecialFunc( self._keyDnS ) glutSpecialUpFunc( self._keyUpS ) # deal with platform differences if sys.platform=="darwin": self._reverseDrawOrder = True self._draw_order.reverse() self._hud_man.addElement( "LOG", self._log_pos[0], self._wh[1]-self._log_pos[1], CT.web23f(self._log_col), self._log_life )
def paintText( self ): for (x, y, text, align, col, font) in self.text_list: off = 0 if align=="LEFT": off = 0 elif align=="CENTER": _w, _h = self.textExtents( text, font ) off = -(_w/2) elif align=="RIGHT": _w, _h = self.textExtents( text, font ) off = -_w self.printTxt( x+off, y, text, CT.web23f(col), font)
def init(self): # super super(Dimentions, self).init() # set up HUD LOG self._hud_man.addMsg("LOG", "Booting...", CT.web23f("#0000FF"), -1) # my Vars # ####### # Register keys / Callback into the key_man # clean exit self._key_man.registerFallingCB(27, self.end) self._hud_man.addMsg("LOG", "Ready!", overide_life=33)
def init(self): # super super(HenchSim, self).init() self._hud_man.addMsg("LOG", "Booting...", CT.web23f("#0000FF")) # my Vars self.takes = {} # logging info self.take_no = 1 # current take self.active_take = None # Current active take self.recording = False # flags self.regioning = False # flags self.bar_h = 20 # height of display # timing now = time.time() tmp_time = DT.datetime.fromtimestamp(now) log_time = DT.datetime(tmp_time.year, tmp_time.month, tmp_time.day, 0, 0, 0, 0) self._epoch = CR.timegm(log_time.timetuple()) del (tmp_time, log_time, now) self.now = time.time() - self._epoch # Register keys / Callback into the key_man self._key_man.registerFallingCB(ord('r'), self._startTake) self._key_man.registerFallingCB(ord('o'), self._regionOut) self._key_man.registerFallingCB(ord('p'), self._marker) self._key_man.registerFallingCB(ord('c'), self._endTake) self._key_man.registerFallingCB(ord('a'), self._advanceTake) self._key_man.registerRisingCB(ord('i'), self._regionIn) # clean exit self._key_man.registerFallingCB(27, self.end) # set up Messages self._hud_man.addElement("MSG", self._wh[0] - 200, self._wh[1] - 10, CT.web23f("#FFFFFF"), -1) self._hud_man.addMsg("LOG", "Ready!")
def init(self): # super super(TimeLine, self).init() # set up HUD LOG self._hud_man.addMsg("LOG", "Booting...", CT.web23f("#0000FF"), -1) # my Vars # ####### # draw control self._border_pad = 5 # playback self.start_frame = 1 self.end_frame = 3600 # factors to 24, 25, 30 fps self.play_in = 1 self.play_out = 3600 self.cur_frame = 1 # anims count from 1 self.play_multi = 1. # multiplier self.skip_multi = 1. # after skipping revert to play_multi # Region Markings self.mark_in = 1 # Single Marked Range (in/out) self.mark_out = 3600 # self.mark_active = [] # List of [in,out] pairs, in order self.mark_cached = [] # ditto # View # Magnifying glass dosen't rescale like premiere # these are as a % of mag_bg width, which is scaled to fit canvas size self.mag_in = 0. self.mag_out = 100. self.mag_width = 100. self.mag_width_f = 3600 self.mag_show_in = 1 self.mag_show_out = 3600 self.mag_first = 0. # start of mag region self.f_label_pad = (0, 0) self.f_label_mjrs = 0 # Max Mjr Graticules at current timeline size self.f_label_step = 0 # Steps between Mjrs (actual self.tl_scale = (0, 0) self.tl_font = "BM8" # Cycle Magnification test cases self._test_mag = 0 # timing & playing self.native_frame_dur = 0.04 # 25fps self.play_direction = 0 # -1=Reverse, 0=stop/pause, 1=Forwards # Register keys / Callback into the key_man # ######## # test changing Mag level, start point self._key_man.registerFallingCB(ord("m"), self._testMag) # clean exit self._key_man.registerFallingCB(27, self.end) self._hud_man.addMsg("LOG", "Ready!", overide_life=44) # Start computing UI # ################## self._ext_lock = True # Compute Fixed UI, update min Extents # TODO: In a real application this would be an image, and blitted into place self._fixed_ui_cache = (0, 0) self._computeUIFixed() # Compute Dynamic U self._magZoomed() self._computeUIDyn()