Exemple #1
0
 def on_btnFile_mouseClick(self, event):
     if self.components.choice.stringSelection == 'Gadfly':
         wildcard = wildcard = "Gadfly files (*.gfd)|*.gfd"
         result = dialog.openFileDialog(wildcard=wildcard)
     elif self.components.choice.stringSelection == 'CSV':
         wildcard = "CSV files (*.csv)|*.csv"
         result = dialog.openFileDialog(wildcard=wildcard)
     else:
         result = dialog.openFileDialog()
     if result.accepted:
         dir, filename = os.path.split(result.paths[0])
         if self.components.choice.stringSelection == 'Gadfly':
             filename = os.path.splitext(filename)[0]
         self.components.txtUsername.text = filename
         self.components.txtPassword.text = dir
Exemple #2
0
	def __set_image_path( self, attr_name ):
		result = dialog.openFileDialog( title = Const[ "OPEN_FILE_TITLE" ] )
		if not result.paths:
			return
		
		path = result.paths[ 0 ]
		self.__set_image( attr_name, path, 1 )
 def _getPathFromDialog(self, 
            wildCard = "USB Serial device (*ttyUSB*)|*ttyUSB*|Serial device (*tty*)|*tty*|All files (*.*)|*.*"):
     result = dialog.openFileDialog(wildcard=wildCard)
     if result.accepted:
         return result.paths[0]
     else:
         return '';
Exemple #4
0
    def on_menuFileOpen_select(self, event):
        # should probably have an alert dialog here
        # warning about saving the current file before opening another one
        if self.documentChanged:
            save = self.saveChanges()
            if save == "Cancel":
                # don't do anything, just go back to editing
                return
            elif save == "No":
                # any changes will be lost
                pass
            else:
                if self.documentPath is None:
                    # if the user cancels out of the Save As then go back to editing
                    if not self.on_menuFileSaveAs_select(None):
                        return
                else:
                    self.saveFile(self.documentPath)

        # split this method into several pieces to make it more flexible
        wildcard = "Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*"
        result = dialog.openFileDialog(wildcard=wildcard)
        if result.accepted:
            path = result.paths[0]
            # an error will probably occur here if the text is too large
            # to fit in the wxTextCtrl (TextArea) or the file is actually
            # binary. Not sure what happens with CR/LF versus CR versus LF
            # line endings either
            self.openFile(path)
Exemple #5
0
 def on_cmdTileset_mouseClick(self, event):
     wildcard = "Image files (*.png)|*.png;*.PNG|All files (*.*)|*.*"
     result = dialog.openFileDialog(None, "Open TileSet", "", "", wildcard)
     if result.accepted:
         # TODO: check if valid!!!
         path = result.paths[0]
         self.loadTileSet(path)
    def GetOutputFileBaseName(self):
        """Get base name of the corpus files

        @expr: variable containing the base name of the output files
        @wildcard: list of wildcards used in the dialog window to filter types of files
        @result: object returned by the Open File 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)
        @location: variable containing the full path to the base name output file
        @self.outputpath: base directory of output files
        @self.outputfile: base name of the output files
        """

        # Default base name of the corpora files that will be produced. If you choose as base name "Corpus.txt", as starting language "EN-GB" and as destination
        # language "FR-FR" the corpora files will be named "Corpus_EN-GB.txt" and "Corpus_FR-FR.txt"
        expr = 'Corpus'
        #open a dialog that lets you choose the base name of the corpora files that will be produced.
        wildcard = "Text files (*.txt;*.TXT)|*.txt;*.TXT"
        result = dialog.openFileDialog(None,
                                       "Name of corpus file",
                                       self.inputdir,
                                       expr,
                                       wildcard=wildcard)
        if result.accepted:
            location = os.path.split(result.paths[0])
            self.outputpath = location[0]
            self.outputfile = location[1]
            if not os.path.exists(self.outputpath + '\\_processing_info'):
                try:
                    os.mkdir(self.outputpath + '\\_processing_info')
                except:
                    result1 = dialog.alertDialog(self, "The program can't create the directory " + self.outputpath+r'\_processing_info, which is necessary for ' + \
                        'the creation of the output files. The program will now close.','Error')
                    sys.exit()
Exemple #7
0
 def on_btnIconFile_mouseClick(self, event):
     wildcard = "Icon Files (*.ico)|*.ico|XPM Files (*.xpm)|*.xpm|All Files (*.*)|*.*"
     result = dialog.openFileDialog(wildcard=wildcard)
     if result.accepted:
         path = result.paths[0]
         filename = util.relativePath(self.parent.filename, path)
         self.components.fldIcon.text = filename
Exemple #8
0
 def on_load_command(self, event):
     '''
         Load project in json format
     '''
     try:
         if self.changedFlag:
             result = dialog.messageDialog(self, 'Unsaved work.\nContinue?', 'Warning', wx.ICON_WARNING | wx.YES_NO)
             if not result.accepted:
                 return
         result = dialog.openFileDialog(self, 'Load', '', '', '*.json')
         if result.accepted:
             self.filename = result.paths[0]
             self.components.usedFileName.text = self.filename
             f = open(self.filename, "rt")
             d = json.loads(f.read())
             f.close()
             me = self.components
             self.initJALCode = d['initJALCode']
             self.task_list = d['task_list']
             me.picmodel.selection = d['picmodel']
             me.cpufreq.selection = d['cpufreq']
             me.prescaler.selection = d['prescaler']
             me.inittmr0.text = str(d['inittmr0'])
             L = []
             for i, t in enumerate(self.task_list):
                 l = [str(i), str(t['period']), t['name'], t['body']]
                 L.append(l)
             self.components.tasklist.items = L
             self._format_tasklist()
         self.changedFlag = False
         self.on_inittmr0_textUpdate(None)
     except Exception as ex:
         self._error(ex, 'Error loading file')
Exemple #9
0
    def on_menuFileOpen_select(self, event):
        if self.components.document.GetModify():
            save = self.saveChanges()
            if save == "Cancel":
                # don't do anything, just go back to editing
                return
            elif save == "No":
                # any changes will be lost
                pass
            else:
                if self.documentPath is None:
                    # if the user cancels out of the Save As then go back to editing
                    if not self.on_menuFileSaveAs_select(None):
                        return
                else:
                    self.saveFile(self.documentPath)

        # split this method into several pieces to make it more flexible
        #wildcard = "Python scripts (*.py;*.pyw)|*.py;*.pyw|Text files (*.txt)|*.txt|All files (*.*)|*.*"
        wildcard = self.resource.strings.saveAsWildcard
        result = dialog.openFileDialog(None, self.resource.strings.openFile,
                                       '', '', wildcard)
        if result.accepted:
            path = result.paths[0]
            # an error will probably occur here if the text is too large
            # to fit in the wxTextCtrl (TextArea) or the file is actually
            # binary. Not sure what happens with CR/LF versus CR versus LF
            # line endings either
            self.openFile(path)
Exemple #10
0
 def on_menuFileOpen_select(self, event):
     result = dialog.openFileDialog(self, 'Open', self.defaultPath(), '',
                                    '*.box')
     if result.accepted:
         path = result.paths[0]
         self.openDrawing(path)
         self.refresh()
    def GetOutputFileBaseName(self):
        """Get base name of the corpus files

        @expr: variable containing the base name of the output files
        @wildcard: list of wildcards used in the dialog window to filter types of files
        @result: object returned by the Open File 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)
        @location: variable containing the full path to the base name output file
        @self.outputpath: base directory of output files
        @self.outputfile: base name of the output files
        """
        
        # Default base name of the corpora files that will be produced. If you choose as base name "Corpus.txt", as starting language "EN-GB" and as destination
        # language "FR-FR" the corpora files will be named "Corpus_EN-GB.txt" and "Corpus_FR-FR.txt"
        expr='Corpus'
        #open a dialog that lets you choose the base name of the corpora files that will be produced. 
        wildcard = "Text files (*.txt;*.TXT)|*.txt;*.TXT"
        result = dialog.openFileDialog(None, "Name of corpus file", self.inputdir,expr,wildcard=wildcard)
        if result.accepted:
            location=os.path.split(result.paths[0])
            self.outputpath=location[0]
            self.outputfile = location[1]
            if not os.path.exists(self.outputpath+'\\_processing_info'):
                try:
                    os.mkdir(self.outputpath+'\\_processing_info')
                except:
                    result1 = dialog.alertDialog(self, "The program can't create the directory " + self.outputpath+r'\_processing_info, which is necessary for ' + \
                        'the creation of the output files. The program will now close.','Error')
                    sys.exit()
Exemple #12
0
 def openFile(self):
     wildcard = "All files (*.*)|*.*"
     result = dialog.openFileDialog(None, "Import which file?", '', '', wildcard)
     if result.accepted:
         path = result.paths[0]
         os.chdir(os.path.dirname(path))
         try:
             self.filename = path
             
             filename = os.path.splitext(os.path.basename(path))[0]
             if filename.startswith('spiro'):
                 items = filename[5:].split('_')
                 comp = self.components
                 comp.sldFixedCircleRadius.value = int(items[0])
                 comp.sldMovingCircleRadius.value = int(items[1])
                 comp.sldMovingCircleOffset.value = int(items[2])
                 comp.btnColor.backgroundColor = eval(items[3])
                 comp.chkDarkCanvas.checked = int(items[4])
                 if items[5] == 'L':
                     comp.radDrawingStyle.stringSelection = 'Lines'
                 else:
                     comp.radDrawingStyle.stringSelection = 'Points'
                 comp.sldRevolutionsInRadians.value = int(items[6])
                 self.setSliderLabels()
 
                 bmp = graphic.Bitmap(self.filename)
                 self.components.bufOff.drawBitmap(bmp, (0, 0))
         except IOError, msg:
             pass
Exemple #13
0
 def on_menuFileOpen_select(self, event):        
     # split this method into several pieces to make it more flexible
     wildcard = "Grep files (*.grep)|*.grep|All files (*.*)|*.*"
     result = dialog.openFileDialog(wildcard=wildcard)
     if result.accepted:
         path = result.paths[0]
         self.loadGrepFile(path)
Exemple #14
0
 def on_menuFileOpen_select(self, event):
     result = dialog.openFileDialog(self, 'Open',
                                    self.defaultPath(), '', '*.box' )
     if result.accepted:
         path = result.paths[0]            
         self.openDrawing(path)
         self.refresh()
Exemple #15
0
 def on_idFileBtn_mouseClick(self, event):
     # select SSH private key file
     title = 'Select SSH private key file'
     start = os.path.join(os.path.expanduser('~'), '.ssh')
     wildcard = "All Files|*"
     result = dialog.openFileDialog(self, 'Open', start, '', wildcard)
     if result.accepted:
         self.components.identityFile.text = result.paths[0]
Exemple #16
0
 def openFile(self):
     result = dialog.openFileDialog(None, "Import which file?")
     if result.accepted:
         path = result.paths[0]
         os.chdir(os.path.dirname(path))
         self.filename = path
         bmp = graphic.Bitmap(self.filename)
         self.components.bufOff.drawBitmap(bmp, (0, 0))
Exemple #17
0
 def on_wFile_mouseClick(self, event):
     path, filename = os.path.split(self.components.wField.text)
     result = dialog.openFileDialog(self, directory=path, filename=filename)
     if result.accepted:
         self.components.wField.text = util.relativePath(
             self._parent.filename, result.paths[0])
         if self.autoAttributeUpdate:
             self.updateComponent()
Exemple #18
0
 def openFile(self):
     result = dialog.openFileDialog(None, "Import which file?")
     if result.accepted:
         path = result.paths[0]
         os.chdir(os.path.dirname(path))
         self.filename = path
         bmp = graphic.Bitmap(self.filename)
         self.components.bufOff.drawBitmap(bmp, (0, 0))
 def _getPathFromDialog(
     self, wildCard="USB Serial device (*ttyUSB*)|*ttyUSB*|Serial device (*tty*)|*tty*|All files (*.*)|*.*"
 ):
     result = dialog.openFileDialog(wildcard=wildCard)
     if result.accepted:
         return result.paths[0]
     else:
         return ""
Exemple #20
0
 def on_btnFile_command(self, event):
     which = event.target.name.replace("btn", "")
     path, filename = os.path.split(self.components["fld"+which].text)
     result = dialog.openFileDialog(self, directory=path, filename=filename)
     #rint result.paths[0]
     if result.accepted:
         self.components["fld"+which].text = util.relativePath(self._parent.filename, result.paths[0])
         self.updateComponent(which)
Exemple #21
0
 def on_load_mouseClick(self, event):
     filename = self.components.filename.text
     path, filename = os.path.split(filename)
     wildcard = "MP3 files (*.mp3)|*.mp3"
     result = dialog.openFileDialog(self, 'Open', path, filename, wildcard)
     if result.accepted:
         path = result.paths[0]
         self.components.filename.text = path
Exemple #22
0
 def on_btnFile_mouseClick(self, event):
     # wildcard = "JPG files (*.jpg;*.jpeg)|*.jpg;*.jpeg|GIF files (*.gif)|*.gif|All Files (*.*)|*.*"
     wildcard = "Wave files (*.wav)|*.wav;*.WAV"
     path = ''
     filename = ''
     result = dialog.openFileDialog(wildcard=wildcard)
     if result.accepted:
         s = result.paths[0]
         self.components.fldFilename.text = s
Exemple #23
0
 def chooseByWin(self):
     pattern = "Img files (*.img)|*.img"
     result = dialog.openFileDialog(self, 'Choose the image', '', '',
                                    pattern)
     if result.accepted:
         filepath = result.paths[0]
         return filepath
     else:
         print "Not to select"
         return (None, None)
Exemple #24
0
 def on_menuFileOpen_select(self, event):
     currentDir = os.getcwd()
     wildcard = "Turtle files (*.py)|*.py"
     path = 'scripts'
     filename = ''
     result = dialog.openFileDialog(self, 'Open', path, filename, wildcard)
     if result.accepted:
         self.fNameTurtleScript = result.paths[0]
         os.chdir(currentDir)
         self.doDraw()
Exemple #25
0
 def on_menuFileOpen_select(self, event):
     # split this method into several pieces to make it more flexible
     wildcard = "Text files (*.txt)|*.txt;*.TXT|All files (*.*)|*.*"
     result = dialog.openFileDialog(wildcard=wildcard)
     if result.accepted:
         path = result.paths[0]
         # an error will probably occur here if the text is too large
         # to fit in the wxTextCtrl (TextArea) or the file is actually
         # binary. Not sure what happens with CR/LF versus CR versus LF
         # line endings either
         self.openFile(path)
Exemple #26
0
    def on_menuLoadMeetingState_select(self, event):
        event.skip()
        wildcard = "Meeting files (*.mtg)|*.*"
        result = dialog.openFileDialog(wildcard=wildcard)


        if result.accepted:
            path = result.paths[0]
            self.currentSavePath = path
            global p
            self.setParliamentInstance(pickle.load(open(path)))
            self.statusChanged()
Exemple #27
0
    def on_appLicenceBtn_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.appLicence.text)
        refpath = os.path.join(self.parent.cfg.get('ConfigData', 'projects'),
                               self.parent.components.baseDir.text)

        title = 'Select path to project licence file'
        result = dialog.openFileDialog(self, title, refpath)

        if result.accepted:
            path = self.parent.getRelativePath(refpath, result.paths[0])
            self.components.appLicence.text = path
Exemple #28
0
 def on_menuSlideshowChooseZip_select(self, event):
     wildcard = "Zip archives (*.zip)|*.ZIP;*.zip"
     if 0:
         if self.documentPath is None:
             dir = ''
             filename = '*.txt'
         else:
             dir = os.path.dirname(self.documentPath)
             filename = os.path.basename(self.documentPath)
     result = dialog.openFileDialog(self, 'Choose a zip', wildcard=wildcard)
     if result.accepted:
         self.buildFileListFromZip(result.paths[0])
         self.on_menuSlideshowFirstSlide_select(None)
Exemple #29
0
 def selectAndImgChk(self, pathname):
     pattern = "Img files (*.img)|*.img"
     if os.path.isfile(pathname) is True:
         return pathname
     else:
         path, filename = os.path.split(pathname)
     result = dialog.openFileDialog(self, 'Open', path, filename, pattern)
     if result.accepted:
         print "Select target file"
         filename = ntpath.basename(result.paths[0])
         return result.paths[0]
     else:
         print "Not to select"
         return (None, None)
Exemple #30
0
 def on_btnChangeDirs_mouseClick(self, event):
     wildcard = "Grep files (*.grep)|*.grep"
     result = dialog.openFileDialog(wildcard=wildcard)
     if result.accepted:
         s = result.paths[0]
         self.dir = os.path.dirname(s)
         fileList = [] 
         filenames = os.listdir(self.dir)
         for fName in filenames:
             root, ext = os.path.splitext(fName)
             if ext == '.grep':
                 fileList.append(fName)
         fileList.sort() # again, need a case-insensitive sort
         self.components.listFiles.items = fileList
Exemple #31
0
    def on_menuScriptletRunScriptlet_select(self, event):
        self.loadShell()

        #curDir = os.getcwd()
        if self.application.shell is not None:
            #wildcard = "Python files (*.py)|*.py|All Files (*.*)|*.*"
            wildcard = self.resource.strings.scriptletWildcard
            # wildcard = '*.py'
            scriptletsDir = os.path.join(self.application.applicationDirectory,
                                         'scriptlets')
            result = dialog.openFileDialog(self,
                                           self.resource.strings.openFile,
                                           scriptletsDir, '', wildcard)
            if result.accepted:
                filename = result.paths[0]
                self.execScriptlet(filename)
Exemple #32
0
    def openFile(self):
        self.openingFileDialog = 1
        wildcard = "Life files (*.lif)|*.lif;*.LIF"
        directory = os.path.join(self.application.applicationDirectory,
                                 'patterns')
        result = dialog.openFileDialog(None, "Import which file?", directory,
                                       '', wildcard)
        if result.accepted:
            path = result.paths[0]
            os.chdir(os.path.dirname(path))
            self.filename = path

            description, patterns, topLeft, size = lifeutil.readLifeFile(path)
            print description
            print "topLeft:", topLeft, "size", size
            self.initAndPlacePatterns(patterns, topLeft, size)
Exemple #33
0
    def on_menuLoadRuleset_select(self, event):
        event.skip()
        result = dialog.messageDialog(self, 'Currently, loading a new ruleset will CLEAR ALL MEETING HISTORY AND STATUS, just like Start Over. Are you sure you want to clear all?', 'Are you sure?',
                               wx.ICON_EXCLAMATION |
                               wx.YES_NO | wx.NO_DEFAULT)

        if result.accepted:
            wildcard = "Ruleset files (*_ruleset.py)|*_ruleset.py|All Files (*.*)|*.*"
            result = dialog.openFileDialog(wildcard=wildcard)

            if result.accepted:
                path = result.paths[0]
                global p
                self.setParliamentInstance(Parliament.Parliament(path))
                self.p.initState()
                self.statusChanged()
Exemple #34
0
 def on_load_command(self, event):
     '''
         Load JSON document
     '''
     try:
         wildcard = "JSON files (*.json)|*.json|All Files (*.*)|*.*"
         result = dialog.openFileDialog(wildcard=wildcard)
         if result.accepted:
             filename = result.paths[0]
             with open(filename, 'rb') as f:
                 self.cfg = json.loads(f.read())
             self.populate_table()
             self.loadedFilename = filename
             self.title = self.loadedFilename
     except Exception as ex:
         err = traceback.format_exc()
         dialog.messageDialog(self, err, 'Error', wx.ICON_ERROR | wx.OK)
Exemple #35
0
 def on_cmdOpen_mouseClick(self, event):
     if self.changedFile:
         save = self.saveChanges()
         if save == "Cancel":
             # don't do anything, just go back to editing
             return
         elif save == "No":
             # any changes will be lost
             pass
         else:
             self.on_cmdSave_mouseClick(event)
     wildcard = "Map files (*.map)|*.map;*.MAP|All files (*.*)|*.*"
     dir = os.path.dirname('.')
     filename = ""#os.path.basename('NewMap')
     result = dialog.openFileDialog(None, "Open Map", dir, filename, wildcard)
     if result.accepted:
         path = result.paths[0]
         self.openMap(path)
         self.changedFile = True
Exemple #36
0
 def ImportStack(self):
     """imports stacks of the format described in
     Managing Gigabytes
     Compressing and Indexing Documents and Images
     Second Edition, 1999
     http://www.cs.mu.oz.au/mg/
     source at http://www.cs.mu.oz.au/mg/mg-1.2.1.tar.gz
     """
     wildcard = "stack files (*.stack)|*.stack|All Files (*.*)|*.*"
     result = dialog.openFileDialog(None, "Import which stack?", '', '',
                                    wildcard)
     if result.accepted:
         path = result.paths[0]
         file = open(path, "r")
         cards = file.read().split(str(chr(2)))
         for text in cards:
             self.CreateCard(at_end=1,
                             text=re.sub("\r", "\n", text),
                             and_set=0)
         file.close()
         self.SetCard(0)
Exemple #37
0
 def on_menuFileOpen_select(self, event):
     result = dialog.openFileDialog()
     if result.accepted:
         self.openFile(result.paths[0])
Exemple #38
0
 def on_menuFileOpen_select(self, event):        
     wildcard = "HTML files (*.htm;*.html)|*.htm;*.html|All files (*.*)|*.*"
     result = dialog.openFileDialog(None, "Open file", '', '', wildcard)
     if result.accepted:
         path = result.paths[0]
         self.openFile(path)

"""
This the Pythoncard interface.
Not using it now since py2exe is chocking on pythoncard
"""

from PythonCard import model
from PythonCard import dialog
import makeidf


class Minimal(model.Background):
    pass 
    
if __name__ == '__main__':
    app = model.Application(Minimal)
    wildcard = '*.txt'
    result = dialog.openFileDialog(wildcard=wildcard, style=dialog.wx.OPEN)
    if result.accepted:
        fname = result.paths[0]
        txt = open(fname, 'r').read()
        eplustxt = makeidf.makeidf(txt) 
    open('ee.idf', 'wb').write(eplustxt)
    wildcard = '*.idf'
    result = dialog.saveFileDialog(wildcard=wildcard)
    if result.accepted:
        fname = result.paths[0]
        open(fname, 'wb').write(eplustxt)
    app.Exit()
referee._genmove_white:  GnuGo or I am mistaken.  pass.  {'territory_labels': [['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral'], ['neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral', 'neutral']], 'ambassador': <ambassador.ambassador_class object at 0x036977F0>, 'verbose': True, 'white_rank': -14, 'extra_stone_black': 0, 'news_time': 0, 'gift_function': {'hide_gift': <bound method referee_class._give_hide of <referee.referee_class object at 0x037655F0>>, 'extra_stone_gift': <bound method referee_class._give_extra_stone of <referee.referee_class object at 0x037655F0>>}, 'moves': [], 'extra_stone_max': 1, 'previous_territory_labels': [[None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None], [None, None, None, None, None, None, None, None, None]], 'previous_danger': [], 'previous_stone_dictionary': {'white': [(0, 3), (0, 4), (1, 4), (1, 5), (2, 5), (3, 5), (4, 4), (5, 4), (6, 3), (6, 4), (6, 6), (7, 2), (7, 3), (8, 1), (8, 2)], 'black': [(0, 2), (1, 3), (2, 2), (2, 4), (3, 3), (3, 4), (4, 2), (4, 3), (5, 3), (6, 1), (6, 2), (7, 0), (7, 1), (8, 0)]}, 'extra_stone_gift': 0, 'previous_hidden': {}, 'black': 'human', 'board': [[',', ',', 'X', 'O', 'O', ',', ',', ',', ','], [',', ',', ',', 'X', 'O', 'O', ',', ',', ','], [',', ',', 'X', ',', 'X', 'O', ',', ',', ','], [',', ',', ',', 'X', 'X', 'O', ',', ',', ','], [',', ',', 'X', 'X', 'O', ',', ',', ',', ','], [',', ',', ',', 'X', 'O', ',', ',', ',', ','], [',', 'X', 'X', 'O', 'O', ',', 'O', ',', ','], ['X', 'X', 'O', 'O', ',', ',', ',', ',', ','], ['X', 'O', 'O', ',', ',', ',', ',', ',', ',']], 'stone_dictionary': {}, 'black_rank': -39, 'white': 'computer', 'previous_turn': None, 'more': None, 'turns_in_a_row_max': 4, 'hide_max': 3, 'hide_gift': 0, 'previous_warning': [(0, 2), (1, 3)], 'undo_gift': 1, 'move_colors': [], 'news': {}, 'now': {}, 'secret_gifts': ['extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift', 'extra_stone_gift'], 'hidden': {}, 'present': {'suicide_white': [(2, 3)]}, 'turn': None, 'previous_genmove': None, 'history': [{}]}
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\project\lifeanddeath\ambassador.py", line 1395, in act_black
    return self._notify_gtp(client_request)
  File "C:\project\lifeanddeath\ambassador.py", line 1400, in _notify_gtp
    self._listen_gtp(gtp_commands)
  File "C:\project\lifeanddeath\ambassador.py", line 1422, in _listen_gtp
    gtp_command, gtp_response)
  File "C:\project\lifeanddeath\referee.py", line 4766, in act_white_gtp
    gtp_command, gtp_response)
  File "C:\project\lifeanddeath\referee.py", line 4617, in _genmove_white
    self.log_move(color, 'pass')
  File "C:\project\lifeanddeath\referee.py", line 4421, in log_move
    if 'pass' == self.history[-2].get(opposite(color)):
IndexError: list index out of range
>>> # white sees empty board.
>>> ambassador.referee.load('sgf/score_9x9_white_by_18.sgf')
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\project\lifeanddeath\referee.py", line 3953, in load
    history = sgf_to_history(file)
  File "C:\project\lifeanddeath\referee.py", line 5896, in sgf_to_history
    def sgf_to_history(file):
  File "C:\project\python\text.py", line 11, in load
    file = codecs.open(os.path.abspath(path), 'r', 'utf-8')
  File "C:\Python25\lib\codecs.py", line 817, in open
    file = __builtin__.open(filename, mode, buffering)
IOError: [Errno 2] No such file or directory: 'C:\\project\\lifeanddeath\\sgf\\score_9x9_white_by_18.sgf'
>>> dialog.openFileDialog()
Exemple #41
0
 def on_btnFile_mouseClick(self, event):
     result = dialog.openFileDialog()
     if result.accepted:
         path = result.paths[0]
         filename = util.relativePath(self.parent.filename, path)
         self.components.fldImage.text = filename