Example #1
0
def main():
    """Main game loop"""
    stdscr = curses.initscr()
    # TODO: add title
    curses.noecho()
    # initialize curses color
    curses.start_color()
    # TODO: initialize array of color pairs?
    # turn off cursor
    curses.curs_set(0)
    # begin game loop
    stdscr.keypad(1)
    curses.raw()

    bigletters, newstops, newspic = loadgraphics()

    loadinitfile() # does nothing yet, possible deprecated

    # load site map data
    oldMapMode = readConfigFile('sitemaps.txt')
    if not oldMapMode:
        stdscr.addstr('Failed to load sitemaps.txt! Reverting to old map mode.')
        stdscr.refresh()
        stdscr.getch()

    # quit game
    quit(stdscr)
Example #2
0
 def loadFile(self, fileName=None, startDir=None):
     if fileName is None:
         if startDir is None:
             startDir = self.filePath
         if startDir is None:
             startDir = '.'
         self.fileDialog = pg.FileDialog(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
         #self.fileDialog.setFileMode(QtGui.QFileDialog.AnyFile)
         #self.fileDialog.setAcceptMode(QtGui.QFileDialog.AcceptSave) 
         self.fileDialog.show()
         self.fileDialog.fileSelected.connect(self.loadFile)
         return
         ## NOTE: was previously using a real widget for the file dialog's parent, but this caused weird mouse event bugs..
         #fileName = QtGui.QFileDialog.getOpenFileName(None, "Load Flowchart..", startDir, "Flowchart (*.fc)")
     fileName = str(fileName)
     state = configfile.readConfigFile(fileName)
     self.restoreState(state, clear=True)
     self.viewBox.autoRange()
     #self.emit(QtCore.SIGNAL('fileLoaded'), fileName)
     self.sigFileLoaded.emit(fileName)