Exemplo n.º 1
0
    def __init__(self):
        QtWidgets.QMainWindow.__init__(self)
        self.About = None
        self.Survey = None
        self.undo = None  # UndoQueue for queries
        self.undo_program = None
        self.selectedRelation = None
        self.ui = maingui.Ui_MainWindow()
        self.user_interface = UserInterface()
        self.history_current_line = None

        # Creates the UI
        self.ui.setupUi(self)

        # Setting fonts for symbols
        f = QtGui.QFont()
        size = f.pointSize()
        if sys.platform.startswith('win'):
            winFont = 'Cambria'
            symbolFont = 'Segoe UI Symbol'
            increment = 4
        else:
            winFont = f.family()
            symbolFont = f.family()
            increment = 2
        font = QtGui.QFont(winFont, size + increment)
        sfont = QtGui.QFont(symbolFont)
        self.ui.lstHistory.setFont(font)
        self.ui.txtMultiQuery.setFont(font)
        self.ui.txtQuery.setFont(font)
        self.ui.groupOperators.setFont(font)
        self.ui.cmdClearMultilineQuery.setFont(sfont)
        self.ui.cmdClearQuery.setFont(sfont)

        self.settings = QtCore.QSettings()
        self._restore_settings()

        # Shortcuts
        shortcuts = (
            (self.ui.lstRelations, QtGui.QKeySequence.Delete,
             self.unloadRelation),
            (self.ui.lstRelations, 'Space',
             lambda: self.printRelation(self.ui.lstRelations.currentItem())),
            (self.ui.txtQuery, QtGui.QKeySequence.MoveToNextLine,
             self.next_history),
            (self.ui.txtQuery, QtGui.QKeySequence.MoveToPreviousLine,
             self.prev_history),
        )

        self.add_shortcuts(shortcuts)
Exemplo n.º 2
0
                print >> sys.stderr, "Module relational_gui is missing.\nPlease install relational package."
                sys.exit(3)
        else:
            try:
                from relational_pyside import maingui, guihandler, about, surveyForm
            except:
                print >> sys.stderr, "Module relational_pyside is missing.\nPlease install relational package."
                sys.exit(3)

        about.version = version
        surveyForm.version = version
        guihandler.version = version

        app = QtGui.QApplication(sys.argv)

        ui = maingui.Ui_MainWindow()
        Form = guihandler.relForm(ui)

        #if os.name=='nt':
        Form.setFont(QtGui.QFont("Dejavu Sans Bold"))

        ui.setupUi(Form)

        for i in range(len(files)):
            if not os.path.isfile(files[i]):
                print >> sys.stderr, "%s is not a file" % files[i]
                printhelp(12)
            f = files[i].split('/')
            defname = f[len(f) - 1].lower()
            if defname.endswith(".csv"):  #removes the extension
                defname = defname[:-4]