def do_init(self, license=None): # We ignore the license, not needed in the player import MMurl, windowinterface opts, files = self.tmpopts, self.tmpfiles del self.tmpopts del self.tmpfiles self._tracing = 0 self.nocontrol = 0 # For player compatability self._closing = 0 self._mm_callbacks = {} self.tops = [] self.last_location = '' try: import mm, posix, fcntl except ImportError: pass else: pipe_r, pipe_w = posix.pipe() mm.setsyncfd(pipe_w) self._mmfd = pipe_r windowinterface.select_setcallback( pipe_r, self._mmcallback, (posix.read, fcntl.fcntl, fcntl)) self.commandlist = [ OPEN(callback=(self.open_callback, ())), OPENFILE(callback=(self.openfile_callback, ())), OPEN_RECENT(callback=self.open_recent_callback), # Dynamic cascade # RELOAD(callback = (self.reload_callback, ())), PREFERENCES(callback=(self.preferences_callback, ())), CHECKVERSION(callback=(self.checkversion_callback, ())), EXIT(callback=(self.close_callback, ())), CHOOSESKIN(callback=(self.skin_callback, ())), ## CHOOSECOMPONENTS(callback = (self.components_callback, ())), ] import settings if hasattr(windowinterface, 'is_embedded') and windowinterface.is_embedded(): settings.factory_defaults() if settings.get('debug'): self.commandlist = self.commandlist + [ TRACE(callback=(self.trace_callback, ())), DEBUG(callback=(self.debug_callback, ())), CRASH(callback=(self.crash_callback, ())), ] MainDialog.__init__(self, 'GRiNS') # first open all files for file in files: self.openURL_callback(MMurl.guessurl(file), 0) if not files and settings.get('skin'): self.openURL_callback('data:application/smil,<smil/>', 0, 0, 0) self._update_recent(None) # then play them if not hasattr(windowinterface, 'is_embedded') or not windowinterface.is_embedded(): for top in self.tops: top.player.playsubtree(top.root)
def do_init(self, license=None): # We ignore the license, not needed in the player import MMurl, windowinterface self._tracing = 0 self.nocontrol = 0 # For player compatability self._closing = 0 self.tops = [] self.last_location = '' self.commandlist = [ OPEN(callback=(self.open_callback, ())), OPENFILE(callback=(self.openfile_callback, ())), EXIT(callback=(self.close_callback, ())), ] if not hasattr(features, 'trial') or not features.trial: self.commandlist.append( CHOOSESKIN(callback=(self.skin_callback, ()))) import settings MainDialog.__init__(self, 'GRiNS') if settings.get('skin'): self.openURL_callback(EMPTYDOC, askskin=0)
def do_init(self, license): opts, files = self.tmpopts, self.tmpfiles del self.tmpopts del self.tmpfiles ## del self.tmplicensedialog import MMurl import windowinterface if features.lightweight and len(files) > 1: windowinterface.showmessage( 'Cannot open multiple files in this product.') files = files[:1] self._license = license ## if not self._license.have('save'): ## windowinterface.showmessage( ## 'This is a demo version.\n'+ ## 'You will not be able to save your changes.', ## title='CMIFed license') self._tracing = 0 self.tops = [] self._mm_callbacks = {} self.last_location = '' self._untitled_counter = 1 self.template_info = None try: import mm, posix, fcntl except ImportError: pass else: pipe_r, pipe_w = posix.pipe() mm.setsyncfd(pipe_w) self._mmfd = pipe_r windowinterface.select_setcallback( pipe_r, self._mmcallback, (posix.read, fcntl.fcntl, fcntl.F_SETFL, posix.O_NDELAY)) self.commandlist = [ EXIT(callback=(self.close_callback, ())), NEW_DOCUMENT(callback=(self.new_callback, ())), OPEN(callback=(self.open_callback, ())), OPENFILE(callback=(self.openfile_callback, ())), OPEN_RECENT(callback=self.open_recent_callback), # Dynamic cascade PREFERENCES(callback=(self.preferences_callback, ())), CHECKVERSION(callback=(self.checkversion_callback, ())), ] import settings if self._license.have('preregistered'): settings.set('registered', 'preregistered') if not self._license.is_evaluation_license() and \ settings.get('registered') != 'preregistered': self.commandlist.append( REGISTER(callback=(self.register_callback, ()))) import Help if hasattr(Help, 'hashelp') and Help.hashelp(): self.commandlist.append(HELP(callback=(self.help_callback, ()))) if __debug__: if settings.get('debug'): self.commandlist = self.commandlist + [ TRACE(callback=(self.trace_callback, ())), DEBUG(callback=(self.debug_callback, ())), CRASH(callback=(self.crash_callback, ())), ] if self.splash is not None: self.splash.unsplash() self.splash = None MainDialog.__init__(self, 'CMIFed', (not not files)) for file in files: self.openURL_callback(MMurl.guessurl(file)) self._update_recent(None) if ENABLE_FNORB_SUPPORT: import CORBA.services self.corba_services = CORBA.services.services(sys.argv) if settings.get('registered') == 'notyet' and \ not self._license.is_evaluation_license(): answer = windowinterface.RegisterDialog() astr = ['yes', 'no', 'notyet'][answer] settings.set('registered', astr) settings.save() if astr == 'yes': self.register_callback()