Beispiel #1
0
 def dumpDocs(self):
     from PythonCard import documentation
     
     result = dialog.directoryDialog(None, 'Create documention in:', '')
     if result.accepted:
         widgetsDir = result.path
         documentation.dumpComponentDocs(self, widgetsDir)
Beispiel #2
0
 def on_ImgArchivePathSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     if result.accepted:
         dir = result.path
         dir = dir.replace("\\","\\\\")
         self.components.ImageArchivePath.text = dir
Beispiel #3
0
 def on_btnDirectory_mouseClick(self, event):
     dir = self.components.fldDirectory.text
     if dir == '':
         dir = self.application.applicationDirectory
     result = dialog.directoryDialog(self, '', dir)
     if result.accepted:
         self.components.fldDirectory.text = result.path
Beispiel #4
0
 def on_ImgArchivePathSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     if result.accepted:
         dir = result.path
         dir = dir.replace("\\","\\\\")
         self.components.ImageArchivePath.text = dir
Beispiel #5
0
 def on_SpecPathSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     if result.accepted:
         dir = result.path
         dir = dir.replace("\\","\\\\")
         self.components.SpecPath.text = dir
         self.init_SpecFile()
Beispiel #6
0
 def on_SpecPathSel_mouseClick(self,event):        
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     if result.accepted:
         dir = result.path
         #dir = dir.replace("\\","\\\\")
         self.components.SpecPath.text = dir
         self.init_SpecFile()
    def on_menuFileNew_select(self, event):
        result = dialog.directoryDialog(self, "Choose a directory", "")
        if result.accepted:
            self.filename = os.path.join(result.path, UNTITLEDFILENAME)
            self._setText("filename", self.filename)

        else:
            return ""
 def on_menuFileNew_select(self, event):
     result = dialog.directoryDialog(self, 'Choose a directory', '')
     if result.accepted:
         self.filename = os.path.join(result.path,UNTITLEDFILENAME)
         self._setText('filename',self.filename)
         
     else:
         return '';
Beispiel #9
0
 def on_menuSlideshowChooseDirectory_select(self, event):
     if self.directory is not None:
         directory = self.directory
     else:
         directory = ''
     result = dialog.directoryDialog(self, 'Choose a directory', directory)
     if result.accepted:
         includeSubDirs = self.menuBar.getChecked(
             'menuOptionsIncludeSubDirectories')
         self.buildFileListFromDirectory(result.path, includeSubDirs)
         self.on_menuSlideshowFirstSlide_select(None)
    def SelectDirectory(self):
        """Select the directory where the TMX files to be processed are

        @result: object returned by the dialog window with attributes accepted (true if user clicked OK button, false otherwise) and
            path (list of strings containing the full pathnames to all files selected by the user)
        @self.inputdir: directory where TMX files to be processed are (and where output files will be written)
        @self.statusBar.text: text displayed in the program window status bar"""

        result = dialog.directoryDialog(self, 'Choose a directory', 'a')
        if result.accepted:
            self.inputdir = result.path
            self.statusBar.text = self.inputdir + ' selected.'
    def SelectDirectory(self):
        """Select the directory where the files to be processed are

        @result: object returned by the dialog window with attributes accepted (true if user clicked OK button, false otherwise) and
            path (list of strings containing the full pathnames to all files selected by the user)
        @self.inputdir: directory where files to be processed are (and where output files will be written)
        @self.statusBar.text: text displayed in the program window status bar"""
        
        result= dialog.directoryDialog(self, 'Choose a directory', 'a')
        if result.accepted:
            self.inputdir=result.path
            self.statusBar.text=self.inputdir+' selected.'
Beispiel #12
0
 def on_menuFile_CD_select(self, event):
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     #print result
     if result.accepted:
         dir = result.path
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\", "\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("Change Dir cancelled.")
         return
Beispiel #13
0
 def on_menuShellChangeDirectory_select(self, event):
     try:
         if self.documentPath:
             path = os.path.dirname(self.documentPath)
         else:
             path = ''
         result = dialog.directoryDialog(self, 'Choose a directory', path)
         if result.accepted:
             path = result.path
             os.chdir(path)
             self.application.shell.run('os.getcwd()')
     except:
         pass
Beispiel #14
0
    def on_tarballsPathBtn_mouseClick(self, event):
        basepath = os.path.join(self.parent.cfg.get('ConfigData', 'projects'),
                                self.parent.components.baseDir.text)
        basepath = os.path.join(basepath, self.components.tarballsPath.text)
        refpath = os.path.join(self.parent.cfg.get('ConfigData', 'projects'),
                               self.parent.components.baseDir.text)

        title = 'Select path to project tarballs directory'
        result = dialog.directoryDialog(self, title, refpath)

        if result.accepted:
            path = self.parent.getRelativePath(refpath, result.path)
            self.components.tarballsPath.text = path
Beispiel #15
0
 def on_menuFile_CD_select(self,event):
     cdir = self.eval_line("pwd()")
     result = dialog.directoryDialog(self, 'Open', cdir)
     #print result
     if result.accepted:
         dir = result.path
         if os.path.abspath(dir) != os.path.abspath(cdir):
             dir = dir.replace("\\","\\\\")
             line = "cd('%s')" % dir
             self.eval_line(line)
     else:
         self.post_message("Change Dir cancelled.")
         return
Beispiel #16
0
 def on_btnAddDirs_mouseClick(self, event):
     wFldDirectories = self.components.fldDirectories
     dirs = wFldDirectories.text
     result = dialog.directoryDialog(self, '', '')
     if result.accepted:
         s = result.path
         if dirs == "":
             wFldDirectories.text = s
         else:
             found = 0
             # should the search be case-insensitive?
             for dir in dirs.split(";"):
                 if s.upper() == dir.upper():
                     found = 1
                     break
             if not found:
                 wFldDirectories.text = dirs + ";" + s
Beispiel #17
0
 def on_baseDirBtn_mouseClick(self, event):
     title = 'Select project base directory'
     basepath = str(self.parent.cfg.get('ConfigData', 'projects'))
     result = dialog.directoryDialog(self, title, basepath,
                                     wx.DD_NEW_DIR_BUTTON)
     if result.accepted:
         # need an error here if the directory selected is not a subdirectory
         # of basepath...
         plist = []
         plist.append(basepath)
         plist.append(str(result.path))
         if os.path.commonprefix(plist) != basepath:
             title = 'Invalid project base directory'
             txt = 'This version of standaloneBuilder does not allow creation '
             txt += 'of projects which reside outside of the projects directory '
             txt += 'specified in your preferences. This issue will be addressed '
             txt += 'in the next version. Yes, it\'s lame - sorry! :-('
             bull = dialog.alertDialog(self, wrap_string(txt, 60), title)
             self.components.baseDir.SetFocus()
         else:
             self.components.baseDir.text = result.path
             self.components.nextBtn.enabled = True
Beispiel #18
0
    def dumpDocs(self):
        #try:
        result = dialog.directoryDialog(None, 'Create widgets_documention in:',
                                        '')
        if result.accepted:
            widgetsDir = result.path
        else:
            return
        widgetsDir = os.path.join(widgetsDir, 'components')
        if not os.path.exists(widgetsDir):
            os.mkdir(widgetsDir)
        imagesDir = os.path.join(widgetsDir, 'images')
        if not os.path.exists(imagesDir):
            os.mkdir(imagesDir)

        toc = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'
        toc += '<html>\n<head><title>%s</title></head><body>\n' % 'PythonCard Components'
        toc += '<h1>PythonCard Components</h1>\n'
        componentsList = []

        for w in self.components.itervalues():
            if w.__class__.__name__.startswith(w.name[3:]):
                # document each widget
                name = w.__class__.__name__
                spec = w._spec

                doc = '<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">'
                doc += '<html>\n<head><title>%s</title></head><body>\n' % (
                    name + ': PythonCard component')
                doc += '<h1>Component: %s</h1>' % name

                doc += '\n<img src="%s"><BR>\n' % ('images/' + name + '.png')

                doc += '\n<h2>Required Attributes</h2>\n'
                doc += '<table border="1">\n'
                doc += '<tr><td><b>Name<b></td><td><b>Default value</b></td></tr>\n'
                for a in self.getAttributesList(spec.getRequiredAttributes()):
                    doc += "<tr><td>%s</td><td>%s</td></tr>\n" % (a[0], a[1])
                doc += '</table>'

                doc += '\n\n<h2>Optional Attributes</h2>\n'
                doc += '<table border="1">\n'
                doc += '<tr><td><b>Name<b></td><td><b>Default value</b></td></tr>\n'
                for a in self.getAttributesList(spec.getOptionalAttributes()):
                    doc += "<tr><td>%s</td><td>%s</td></tr>\n" % (a[0], a[1])
                doc += '</table>'

                doc += '\n\n<h2>Events:</h2>\n'
                doc += '<table border="1">\n'
                for e in self.getEventsList(spec):
                    doc += "<tr><td>%s</td></tr>\n" % e
                doc += '</table>'

                doc += '\n\n<h2>Methods:</h2>\n'
                doc += '<table border="1">\n'
                td = '<td><b>%s</b></td>' * 4
                tr = '<tr>' + td + '</tr>\n'
                doc += tr % ('method', 'args', 'doc string', 'comments')
                for e in self.getMethodsList(w):
                    method = getattr(w, e)
                    docstring = inspect.getdoc(method)
                    if docstring is None:
                        docstring = "&nbsp;"
                    comments = inspect.getcomments(method)
                    if comments is None:
                        comments = "&nbsp;"
                    #source = inspect.getcomments(method)
                    argspec = inspect.getargspec(method)
                    formattedargs = inspect.formatargspec(
                        argspec[0], argspec[1], argspec[2], argspec[3])
                    doc += "<tr><td>%s</td><td>%s</td><td>%s</td><td>%s</td></tr>\n" % \
                        (e, formattedargs, docstring, comments)
                doc += '</table>'

                # need to decide what we want to dump from the methods
                # we probably don't want to dump everything including
                # wxPython methods, so this is where we need to decide
                # on the case of the first letter of the method
                # whatever is done here should be the same thing used
                # to display methods in the shell
                # arg lists and tooltips (docstrings) will be used here too

                # write out the documentation for the component
                doc += '\n<hr><img src="http://sourceforge.net/sflogo.php?group_id=19015&type=1" width="88" height="31" border="0" alt="SourceForge Logo">'
                doc += '\n</body>\n</html>'
                filename = name + '.html'
                path = os.path.join(widgetsDir, filename)
                f = open(path, 'w')
                f.write(doc)
                f.close()

                # create an image using the actual component
                # on screen
                # comment this out once you have created the images
                # you want
                bmp = wx.EmptyBitmap(w.size[0], w.size[1])
                memdc = wx.MemoryDC()
                memdc.SelectObject(bmp)
                dc = wx.WindowDC(w)
                memdc.BlitPointSize((0, 0), w.size, dc, (0, 0))
                imgfilename = os.path.join(imagesDir, name + '.png')
                bmp.SaveFile(imgfilename, wx.BITMAP_TYPE_PNG)
                dc = None
                memdc.SelectObject(wx.NullBitmap)
                memdc = None
                bmp = None

                componentsList.append('<a href="%s">%s</a><br>\n' %
                                      (filename, name))

        # now create the table of contents, index.html
        componentsList.sort()
        for c in componentsList:
            toc += c
        toc += '\n<hr><img src="http://sourceforge.net/sflogo.php?group_id=19015&type=1" width="88" height="31" border="0" alt="SourceForge Logo">'
        toc += '\n</body>\n</html>'
        filename = os.path.join(widgetsDir, 'index.html')
        f = open(filename, 'w')
        f.write(toc)
        f.close()
Beispiel #19
0
 def on_buttonDir_mouseClick(self, event):
     result = dialog.directoryDialog(self, 'Choose a directory', 'a')
     self.components.fldResults.text = "directoryDialog result:\naccepted: %s\npath: %s" % (
         result.accepted, result.path)
Beispiel #20
0
 def on_filechooser_mouseClick(self, event):
     result = dialog.directoryDialog(self, '选择小说下载后保存的目录', 'a')
     if result.accepted:
         self.components.savedir.text = result.path
Beispiel #21
0
def dumpDocs(self):
    result = dialog.directoryDialog(None, 'Create documention in:', '')
    if result.accepted:
        widgetsDir = result.path
        dumpBackgroundDocs(self, widgetsDir)
Beispiel #22
0
 def on_projectsPathBtn_mouseClick(self, event):
     result = dialog.directoryDialog(self, self.components.StaticText2.text,
                                     self.components.projectsPath.text)
     if result.accepted:
         self.components.projectsPath.text = result.path