Esempio n. 1
0
    def __init__(self):
        QMainWindow.__init__(self)
        self.setupUi(self)
        trayicon = QIcon(os.path.join(sys.path[0],'data/tray.png'))
        self.tray = TrayIcon()
        self.tray.setIcon(trayicon)
        self.tray.setParent(self)
        self.tray.setContextMenu(self.menuMenu)
        self.tray.show()

        self.config = Config()
        self.client = GUIElement.Client(self.config)
        if os.name == 'posix':
            self.server = GUIElement.Server(self.config)
        self.preferences = GUIElement.Preferences(self.config)
        
        mount_tab = QTabWidget()    
        mount_tab.setWindowTitle('NFS Mounter')

        mount_tab.addTab(self.client, 'Mount')
        if os.name == 'posix':
            mount_tab.addTab(self.server, 'Share')
        mount_tab.addTab(self.preferences, 'Preferences')

        if os.name == 'posix':
            nfs = NfsBrowser(self.client)
        
        self.setCentralWidget(mount_tab)

        self.actionAdd.connect(self.actionAdd, SIGNAL("triggered()"), self.client.add_line)
        self.tray.connect(self.tray,  SIGNAL("activated(QSystemTrayIcon::ActivationReason)"), self.on_tray_clicked)
        self.actionExit.connect(self.actionExit, SIGNAL('triggered()'), self.on_actionExit_clicked)
class GUIApplication(Application, QObject):
    selected_instance = None
    selected_entity = None

    def __init__(self):
        super(Application, self).__init__()
        super(QObject, self).__init__()

        self.qApp = QApplication([])

        # init main window widget
        self.w = QTabWidget()
        self.w.resize(1300, 700)
        self.w.setWindowTitle("# Hello world!")

        # other init routines
        self.entity_manager = EntityManager()
        self.build_layout()
        self.prepare_result_dirs()

        self.w.show()

    def prepare_result_dirs(self):
        options = CompilerOptions()

        try:
            for d in options.get_output_dirs():
                makedirs(path.join(OUTPUT_ROOT, d))
        except:
            pass

    def run(self):
        self.qApp.exec_()

    def build_layout(self):
        self.result_explorer = ResultExplorer(self.entity_manager)
        self.w.addTab(self.result_explorer, "Result explorer")

        self.query_explorer = QueryExplorer(self.entity_manager)
        self.w.addTab(self.query_explorer, "Queries")