def loadViewAlternatives(self):
     self.filesNames = ['Gobstones', 'PixelBoard']
     program_file = str(self.main_window.fileOption.moduleFile)
     if clothing_for_file_exists(program_file):
         path = clothing_dir_for_file(program_file)
         files = os.listdir(path)
         for f in files:
             fileName, fileExtension = os.path.splitext(os.path.join(path,f))
             if fileExtension == '.xml':
                 self.filesNames.append(os.path.join(path, fileName))
     for fn in self.filesNames:
         (filepath, filename) = os.path.split(fn)
         self.ui.combo.addItem(filename)
 def loadViewAlternatives(self):
     self.filesNames = ['Gobstones', 'PixelBoard']
     program_file = str(self.main_window.fileOption.moduleFile)
     if clothing_for_file_exists(program_file):
         path = clothing_dir_for_file(program_file)
         files = os.listdir(path)
         for f in files:
             fileName, fileExtension = os.path.splitext(
                 os.path.join(path, f))
             if fileExtension == '.xml':
                 self.filesNames.append(os.path.join(path, fileName))
     for fn in self.filesNames:
         (filepath, filename) = os.path.split(fn)
         self.ui.combo.addItem(filename)
Example #3
0
    def newFile(self):

        if self.mainW.ui.textEditFile.document().isModified():
            val = QMessageBox.question(
                self.mainW, i18n('Save changes?'),
                i18n('The file %s was changed, Do you save changes?') %
                (self.mainW.ui.tabWidgetEditors.tabText(0)[3:]),
                QMessageBox.Yes, QMessageBox.No, QMessageBox.Cancel)
            if val == QMessageBox.Yes:
                self.saveFile()
            elif val == QMessageBox.Cancel:
                return
        self.moduleFile = None
        self.clearCurrentModule()
        if clothing_dir_for_file(str(self.moduleFile)):
            self.updateClothingOptions()
            self.mainW.setClothing('Gobstones.xml')
 def onActivated(self, text):
     # [TODO] Abstract the method with the onActivated in Interactive
     if not text == 'Gobstones':
         program_file = str(self.main_window.fileOption.moduleFile)
         if clothing_for_file_exists(program_file):
             fn = str(text) + ".xml"
             path = os.path.join(clothing_dir_for_file(program_file), fn)
             self.ui.tabWidgetResults.widget(0).setClothing(path)
             self.ui.tabWidgetResults.widget(0).update()
             if not self.ui.tabWidgetResults.widget(2).is_board_error():
                 self.ui.tabWidgetResults.widget(2).setClothing(path)
                 self.ui.tabWidgetResults.widget(2).update()
             self.current_clothing = path
             self.nextView = 'Gobstones.xml'
     elif self.current_clothing != 'Gobstones.xml':
         self.switchViews()
     self.switcher.change_state(text)
 def onActivated(self, text):
     # [TODO] Abstract the method with the onActivated in Interactive
     if not text == 'Gobstones':
         program_file = str(self.main_window.fileOption.moduleFile)
         if clothing_for_file_exists(program_file):
             fn = str(text) + ".xml"
             path = os.path.join(clothing_dir_for_file(program_file), fn)
             self.ui.tabWidgetResults.widget(0).setClothing(path)
             self.ui.tabWidgetResults.widget(0).update()
             if not self.ui.tabWidgetResults.widget(2).is_board_error():
                 self.ui.tabWidgetResults.widget(2).setClothing(path)
                 self.ui.tabWidgetResults.widget(2).update()
             self.current_clothing = path
             self.nextView = 'Gobstones.xml'
     elif self.current_clothing != 'Gobstones.xml':
             self.switchViews()
     self.switcher.change_state(text)
Example #6
0
    def newFile(self):

        if self.mainW.ui.textEditFile.document().isModified():
            val = QMessageBox.question(
                self.mainW,
                i18n("Save changes?"),
                i18n("The file %s was changed, Do you save changes?") % (self.mainW.ui.tabWidgetEditors.tabText(0)[3:]),
                QMessageBox.Yes,
                QMessageBox.No,
                QMessageBox.Cancel,
            )
            if val == QMessageBox.Yes:
                self.saveFile()
            elif val == QMessageBox.Cancel:
                return
        self.moduleFile = None
        self.clearCurrentModule()
        if clothing_dir_for_file(str(self.moduleFile)):
            self.updateClothingOptions()
            self.mainW.setClothing("Gobstones.xml")
Example #7
0
    def updateClothingOptions(self):
        if clothing_for_file_exists(str(self.moduleFile)):
            path = clothing_dir_for_file(str(self.moduleFile))
            files = os.listdir(path)
        else:
            files = []
        self.mainW.ui.menuSelectResultView.clear()
        self.filesNames = []
        for f in files:
            fileName, fileExtension = os.path.splitext(os.path.join(path, f))
            if fileExtension == '.xml':
                self.filesNames.append(os.path.join(path, fileName))

        self.mapper = QtCore.QSignalMapper(self.mainW)
        self.actions = {}
        for fn in self.filesNames:
            (filepath, filename) = os.path.split(fn)
            self.addClothing(fn, filename)

        self.addClothing('Gobstones', i18n('Gobstones Standard'))
        self.addClothing('PixelBoard', i18n('Pixel Board'))
        self.mapper.mapped['QString'].connect(self.handleButton)
Example #8
0
    def updateClothingOptions(self):
        if clothing_for_file_exists(str(self.moduleFile)):
            path = clothing_dir_for_file(str(self.moduleFile))
            files = os.listdir(path)
        else:
            files = []
        self.mainW.ui.menuSelectResultView.clear()
        self.filesNames = []
        for f in files:
            fileName, fileExtension = os.path.splitext(os.path.join(path, f))
            if fileExtension == ".xml":
                self.filesNames.append(os.path.join(path, fileName))

        self.mapper = QtCore.QSignalMapper(self.mainW)
        self.actions = {}
        for fn in self.filesNames:
            (filepath, filename) = os.path.split(fn)
            self.addClothing(fn, filename)

        self.addClothing("Gobstones", i18n("Gobstones Standard"))
        self.addClothing("PixelBoard", i18n("Pixel Board"))
        self.mapper.mapped["QString"].connect(self.handleButton)