Ejemplo n.º 1
0
 def initialStatus(self, partialBoard):
     if (self.load_views is None) or (self.load_views != root_path()):
         self.reset_clothing()
         self.loadViewAlternatives()
         self.load_views = root_path()
     self.boardV = BoardViewer(self, parseABoardString(partialBoard), self.mainW.getClothing())
     self.boardV.setParent(self.ui.boardViewer)
     self.ui.boardViewer.removeTab(0)
     self.ui.boardViewer.insertTab(0, self.boardV, i18n('Board'))
     self.setPressAKeyState()
     self.init_switcher()
Ejemplo n.º 2
0
 def initialStatus(self, partialBoard):
     if (self.load_views is None) or (self.load_views != root_path()):
         self.reset_clothing()
         self.loadViewAlternatives()
         self.load_views = root_path()
     self.boardV = BoardViewer(self, parseABoardString(partialBoard), self.mainW.getClothing())
     self.boardV.setParent(self.ui.boardViewer)
     self.ui.boardViewer.removeTab(0)
     self.ui.boardViewer.insertTab(0, self.boardV, i18n('Board'))
     self.setPressAKeyState()
     self.init_switcher()
Ejemplo n.º 3
0
 def loadBoard(self):
     filename = QtGui.QFileDialog.getOpenFileName(self.parent, i18n('Open File'),
     root_path(), '*.gbb')
     if not filename == PyQt4.QtCore.QString(''):
         fname = open(filename)
         data = fname.read()
         self.parent.setInitialBoard(data)
         fname.close()
Ejemplo n.º 4
0
 def saveBoardToImage(self):
     filename = QtGui.QFileDialog.getSaveFileName(self,
                                                  i18n('Save as ...'), 
                                                  root_path(), 
                                                  '*.png')
     if not filename == QtCore.QString(''):
         self.ui.boardEditor.save_to_image(filename)
     self.reset_combo_persist()
Ejemplo n.º 5
0
    def __init__(self):
        super(AboutWidget, self).__init__()
        self.version = QtCore.QString(utils.read_file(os.path.join(utils.root_path(), 'version')))
        self.setModal(True)
        icon = QtGui.QIcon(':/logoGobstones.png')
        self.setWindowIcon(icon)
        self.setWindowTitle(i18n("About"))
        logoHtml = ""
        logoHtml += (       "<div align = 'center'>"
                            '<img src=":/logoHelp.png">'
                            "</div>"
                             )
        versionHtml = ""
        versionHtml += (        '<div align = "center">'
                                "<h3>PyGobstones</h3>"
                                "<p>Versi&oacute;n " + self.version + "</p>".decode('utf8') +
                                "<p>" + i18n("Developed with Python and PyQt") + "</p>"
                                "</div>"
                             )
        logo = QtGui.QLabel(logoHtml)
        version = QtGui.QLabel(versionHtml)
        hLayout = QtGui.QHBoxLayout()
        hLayout.addWidget(logo)
        hLayout.addWidget(version)

        tabs = QtGui.QTabWidget(self)
        tabs.tabBar().setStyleSheet("background-color:'white'; color:'#4682b4'; border:2px solid #4682b4; font-size:15px")
        tabs.tabBar().setAttribute(QtCore.Qt.WA_TranslucentBackground)

        about = self.openAndReturnHelpFile(os.path.join(utils.root_path(), 'about_files','about.html'))
        authors = self.openAndReturnHelpFile(os.path.join(utils.root_path(), 'about_files','authors.html'))
        history = self.openAndReturnHelpFile(os.path.join(utils.root_path(), 'about_files','history.html'))

        tabs.addTab(about, _fromUtf8(""))
        tabs.addTab(authors, _fromUtf8(""))
        tabs.addTab(history, _fromUtf8(""))

        tabs.setTabText(0, i18n("About"))
        tabs.setTabText(1, i18n("Authors"))
        tabs.setTabText(2, i18n("History"))

        vLayout = QtGui.QVBoxLayout()
        vLayout.addLayout(hLayout)
        vLayout.addWidget(tabs)
        self.setLayout(vLayout)
Ejemplo n.º 6
0
 def loadBoard(self):
     filename = QtGui.QFileDialog.getOpenFileName(self.parent,
                                                  i18n('Open File'),
                                                  root_path(), '*.gbb')
     if not filename == PyQt4.QtCore.QString(''):
         fname = open(filename)
         data = fname.read()
         self.parent.setInitialBoard(data)
         fname.close()
Ejemplo n.º 7
0
 def saveBoardFromDisk(self):
     self.board = boardToString(self.ui.boardEditor.getEditedBoard())
     filename = QtGui.QFileDialog.getSaveFileName(self,
     i18n('Save as ...'), root_path(), '*.gbb')
     if not filename == QtCore.QString(''):
         (filep, filen) = os.path.split(str(filename))
         myFile = open(filename, 'w')
         myFile.write(self.board)
         myFile.close()
     self.reset_combo_persist()
Ejemplo n.º 8
0
 def saveBoardFromDisk(self):
     self.board = boardToString(self.ui.boardEditor.getEditedBoard())
     filename = QtGui.QFileDialog.getSaveFileName(self, i18n('Save as ...'),
                                                  root_path(), '*.gbb')
     if not filename == QtCore.QString(''):
         (filep, filen) = os.path.split(str(filename))
         myFile = open(filename, 'w')
         myFile.write(self.board)
         myFile.close()
     self.reset_combo_persist()
Ejemplo n.º 9
0
     def __init__(self):
        super(CommandHelpWidget, self).__init__()
        self.setModal(True)
        self.setWindowTitle(i18n('User guide editor board'))
        tabs = QtGui.QTabWidget(self)
        tabs.tabBar().setStyleSheet("background-color:'white'; color:'#4682b4'; border:2px solid #4682b4; font-size:15px")
        tabs.tabBar().setAttribute(QtCore.Qt.WA_TranslucentBackground)

        command = self.openAndReturnHelpFile(os.path.join(utils.root_path(), 'about_files','command_editor.html'))

        tabs.addTab(command, _fromUtf8(""))

        tabs.setTabText(0, i18n("commands enables"))

        vLayout = QtGui.QVBoxLayout()
        vLayout.addWidget(tabs)
        self.setLayout(vLayout)
Ejemplo n.º 10
0
def main():
    app = QtGui.QApplication(sys.argv)

    #Get the locale settings
    locale = unicode(QtCore.QLocale.system().name())

    # This is to make Qt use locale configuration; i.e. Standard Buttons
    # in your system's language.
    qtTranslator=QtCore.QTranslator()
    qtTranslator.load("qt_" + locale,
                        QtCore.QLibraryInfo.location(
                        QtCore.QLibraryInfo.TranslationsPath)
                        )
    app.installTranslator(qtTranslator)

    path = os.path.join(root_path(), 'commons')

    f = QtGui.QFontDatabase.addApplicationFont(os.path.join(path, 'ubuntu.ttf'))
    font = QtGui.QFont('Ubuntu Titling')
    font.setBold(True)
    font.setPixelSize(16)
    app.setFont(font)

    start = time()
    
    if 'huayra' in platform.uname():
        img = QPixmap(os.path.join(path, 'gobstones_huayra.png'))
    else:
        img = QPixmap(os.path.join(path, 'gobstones.png'))

    splash = QSplashScreen(img)
    splash.show()

    while time() - start < 1:
        app.processEvents()
    
    w = MainWindow()
    icon = QtGui.QIcon(os.path.join(path, 'logo.png'))
    w.setWindowIcon(icon)
    splash.finish(w)
    w.showMaximized()
    sys.exit(app.exec_())
Ejemplo n.º 11
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.initOptions()
     self.initMenuBarActions()
     self.initSignalsAndSlots()
     self.ui.actionStop.setEnabled(False)
     self.clothing = 'Gobstones.xml'
     self.lang = GOBSTONES
     self.initWindowTitle()
     self.initPreferencesDictionary()
     self.initLoggerSize()
     self.initialBoardGenerator = InitialBoardGenerator()
     self.guiInterpreterHandler = GUIInterpreterHandler(self)
     self.programRun = ProgramRun(self.getLang(),
                                 self.guiInterpreterHandler)
     self.rootDirectory = root_path()
     self.runButton = RunButton(self, self.ui.actionRun,
          self.ui.actionStop)
     self.setStyleSheet( "QMainWindow{background-image:url(':/backgroundWidget.png')}")
Ejemplo n.º 12
0
def main():
    app = QtGui.QApplication(sys.argv)

    # Get the locale settings
    locale = unicode(QtCore.QLocale.system().name())

    # This is to make Qt use locale configuration; i.e. Standard Buttons
    # in your system's language.
    qtTranslator = QtCore.QTranslator()
    qtTranslator.load(
        "qt_" + locale,
        QtCore.QLibraryInfo.location(QtCore.QLibraryInfo.TranslationsPath))
    app.installTranslator(qtTranslator)

    path = os.path.join(root_path(), 'commons')

    f = QtGui.QFontDatabase.addApplicationFont(os.path.join(
        path, 'ubuntu.ttf'))
    font = QtGui.QFont('Ubuntu Titling')
    font.setBold(True)
    font.setPixelSize(16)
    app.setFont(font)

    start = time()
    if 'huayra' in platform.uname():
        img = QPixmap(os.path.join(path, 'gobstones_huayra.png'))
    else:
        img = QPixmap(os.path.join(path, 'gobstones.png'))

    splash = QSplashScreen(img)
    splash.show()

    while time() - start < 1:
        app.processEvents()
    w = MainWindow()
    icon = QtGui.QIcon(os.path.join(path, 'logo.png'))
    w.setWindowIcon(icon)
    splash.finish(w)
    w.showMaximized()
    sys.exit(app.exec_())
Ejemplo n.º 13
0
 def __init__(self):
     super(MainWindow, self).__init__()
     self.ui = Ui_MainWindow()
     self.ui.setupUi(self)
     self.initOptions()
     self.initMenuBarActions()
     self.initSignalsAndSlots()
     self.ui.actionStop.setEnabled(False)
     self.ui.actionOpenFileGoogleDrive.setEnabled(False)
     self.ui.actionStop.setEnabled(False)
     self.clothing = 'Gobstones.xml'
     self.lang = GOBSTONES
     self.initWindowTitle()
     self.initPreferencesDictionary()
     self.initLoggerSize()
     self.initialBoardGenerator = InitialBoardGenerator()
     self.guiInterpreterHandler = GUIInterpreterHandler(self)
     self.programRun = ProgramRun(self.getLang(),
                                  self.guiInterpreterHandler)
     self.rootDirectory = root_path()
     self.runButton = RunButton(self, self.ui.actionRun,
                                self.ui.actionStop)
     self.setStyleSheet("QMainWindow{background-image:url(':/backgroundWidget.png')}")
Ejemplo n.º 14
0
 def saveBoardToImage(self):
     filename = QtGui.QFileDialog.getSaveFileName(self, i18n('Save as ...'),
                                                  root_path(), '*.png')
     if not filename == QtCore.QString(''):
         self.ui.boardEditor.save_to_image(filename)
     self.reset_combo_persist()