def _new_ok_callback(self, info): if not info: return if len(info) == 3: d1, d2, filename = info htmltemplate = None else: d1, d2, filename, htmltemplate = info import windowinterface windowinterface.setwaiting() import TopLevel import MMurl from MMExc import MSyntaxError, UserCancel template_url = MMurl.pathname2url(filename) try: top = TopLevel.TopLevel(self, self.getnewdocumentname(filename), template_url) except IOError: import windowinterface windowinterface.showmessage('Cannot open: %s' % filename) except MSyntaxError, msg: message = 'Parse error in document: %s' % filename if msg is not None: message = message + ': %s' % msg import windowinterface windowinterface.showmessage(message, mtype='error')
def __openfile_callback(self): import windowinterface windowinterface.setwaiting() # provide a default directory and file name for the # browser based on the current selection (if any) dir = '.' file = '' url = self.__text.gettext() or self.__lasturl if url: import MMurl type, rest = MMurl.splittype(url) if not type or type == 'file': import os dir, file = os.path.split( MMurl.url2pathname(MMurl.splithost(rest)[1])) filetypes = [ '/SMIL presentation', 'application/x-grins-project', 'application/smil' ] windowinterface.FileDialog('Open file', dir, filetypes, file, self.__filecvt, None, 1, parent=self.__owindow)
def get(url): import urlcache cache = urlcache.urlcache[url] dur = cache.get('duration') if dur is None: mtype = urlcache.mimetype(url) if mtype and mtype.find('mpeg') >= 0: try: fn = MMurl.urlretrieve(url)[0] except IOError, arg: print arg dur = 10 else: try: windowinterface.setwaiting() dur = winmm.GetVideoDuration(fn) except winmm.error, msg: print msg dur = 10
def openURL_callback(self, url): import windowinterface windowinterface.setwaiting() from MMExc import MSyntaxError import TopLevel self.last_location = url try: top = TopLevel.TopLevel(self, url) except IOError: import windowinterface windowinterface.showmessage('Cannot open: %s' % url) except MSyntaxError: import windowinterface windowinterface.showmessage('Parse error in document: %s' % url) else: self.tops.append(top) top.show() top.player.show() self._update_recent(url)
def openURL_callback(self, url, askskin=1): import windowinterface windowinterface.setwaiting() from MMExc import MSyntaxError import TopLevel self.last_location = url try: top = TopLevel.TopLevel(self, url, askskin=askskin) except IOError: import windowinterface windowinterface.showmessage('Cannot open: %s' % url) except MSyntaxError: import windowinterface windowinterface.showmessage('Parse error in document: %s' % url) else: while self.tops: self.tops[0].close_callback() self.tops.append(top) top.show() top.player.show() top.player.play_callback()
def __openfile_callback(self): import windowinterface windowinterface.setwaiting() # provide a default directory and file name for the # browser based on the current selection (if any) dir = '.' file = '' url = self.__text.gettext() or self.__lasturl if url: import MMurl type, rest = MMurl.splittype(url) if not type or type == 'file': import os dir, file = os.path.split( MMurl.url2pathname(MMurl.splithost(rest)[1])) import features from compatibility import Boston if features.compatibility == Boston: filetypes = [ '/SMIL presentation', 'application/smil', 'application/x-grins-project' ] else: filetypes = [ '/SMIL presentation', 'application/x-grins-project', 'application/smil' ] ## import features ## if not features.lightweight: ## filetypes.append('application/x-grins-cmif') windowinterface.FileDialog('Open file', dir, filetypes, file, self.__filecvt, None, 1, parent=self.__owindow)
def openURL_callback(self, url, startplay=1, update_recent=1, askskin=1): import windowinterface windowinterface.setwaiting() from MMExc import MSyntaxError import TopLevel self.last_location = url try: top = TopLevel.TopLevel(self, url, askskin) except IOError: import windowinterface windowinterface.showmessage('Cannot open: %s' % url) except MSyntaxError: import windowinterface windowinterface.showmessage('Parse error in document: %s' % url) else: self.tops.append(top) top.show() top.player.show() if update_recent: self._update_recent(url) if startplay and (not hasattr(windowinterface, 'is_embedded') or not windowinterface.is_embedded()): top.player.playsubtree(top.root)
def openURL_callback(self, url): if not self.canopennewtop(): return import windowinterface self.last_location = url windowinterface.setwaiting() from MMExc import MSyntaxError, UserCancel import TopLevel for top in self.tops: if top.is_document(url): windowinterface.showmessage("Already open: %s" % url) return try: top = TopLevel.TopLevel(self, url, 0) except IOError: import windowinterface windowinterface.showmessage('Cannot open: %s' % url) except MSyntaxError, msg: message = 'Parse error in document: %s' % url if msg is not None: message = message + ': %s' % msg import windowinterface windowinterface.showmessage(message, mtype='error')
def setwaiting(self): windowinterface.setwaiting()
def close_callback(self, exitcallback=None): import windowinterface windowinterface.setwaiting() self.do_exit(exitcallback)
def editcall(self): windowinterface.setwaiting() import NodeEdit NodeEdit.showeditor(self)