Exemple #1
0
 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')
Exemple #2
0
 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)
Exemple #3
0
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
Exemple #4
0
 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)
Exemple #5
0
 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()
Exemple #6
0
    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)
Exemple #7
0
 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)
Exemple #8
0
 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')
Exemple #9
0
 def setwaiting(self):
     windowinterface.setwaiting()
Exemple #10
0
 def close_callback(self, exitcallback=None):
     import windowinterface
     windowinterface.setwaiting()
     self.do_exit(exitcallback)
Exemple #11
0
 def editcall(self):
     windowinterface.setwaiting()
     import NodeEdit
     NodeEdit.showeditor(self)