Ejemplo n.º 1
0
 def __init__(self, sysbus, parent=None):
     super(ManageLogger, self).__init__()
     self.logmgr = LogManager(SERVICE,
                              sysbus,
                              self.show_status)
     self.show_status.connect(self.status_message)
     self.logmgr.show_level.connect(self.proc_level)
     self.logmgr.show_components.connect(self.proc_components)
Ejemplo n.º 2
0
    def __init__(self, sysbus, parent=None):
        QtGui.QWidget.__init__(self, parent)

        # Init ourself from the Designer UI
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)
        # light up the admin interface
        self.admin = AdminInterface(SERVICE, '/org/ganesha/nfsd/admin', sysbus,
                                    self.show_status)
        self.exportmgr = ExportMgr(SERVICE, '/org/ganesha/nfsd/ExportMgr',
                                   sysbus, self.show_status)
        self.clientmgr = ClientMgr(SERVICE, '/org/ganesha/nfsd/ClientMgr',
                                   sysbus, self.show_status)
        self.logmanager = LogManager(SERVICE, sysbus, self.show_status)
        self.logdialog = LogSetDialog(self.logmanager)
        self.show_status.connect(self.status_message)

        # Connect up the ui menubar
        #File
        self.ui.actionDBus_connect.triggered.connect(self.connect_gsh)
        self.ui.actionQuit.triggered.connect(self.quit)
        #Manage
        #Manage->Clients
        self.ui.actionAdd_Client.triggered.connect(self.add_client)
        self.ui.actionRemove_Client.triggered.connect(self.remove_client)
        #Manage->Exports
        self.ui.actionExports.triggered.connect(self.export_mgr)
        #Manage->Log Levels
        self.ui.actionLog_Settings.triggered.connect(self.logsettings)
        #Manage->Admin
        self.ui.actionReset_Grace.triggered.connect(self.reset_grace)
        self.ui.actionShutdown.triggered.connect(self.shutdown)
        self.ui.actionReload.triggered.connect(self.reload)
        #View
        self.ui.actionStatistics.triggered.connect(self.stats)
        self.ui.actionViewExports.triggered.connect(self.view_exports)
        self.ui.actionViewClients.triggered.connect(self.view_clients)
        #Help
        self.ui.actionAbout.triggered.connect(self.help)

        # Dbus data models
        self.exports_show_model = ExportTableModel(self.exportmgr)
        self.clients_show_model = ClientTableModel(self.clientmgr)

        # Tabs, tables, and views
        self.ui.exports.setModel(self.exports_show_model)
        self.ui.exports.resizeColumnsToContents()
        self.ui.exports.verticalHeader().setVisible(False)
        self.ui.clients.setModel(self.clients_show_model)
        self.ui.clients.resizeColumnsToContents()
        self.ui.clients.verticalHeader().setVisible(False)
Ejemplo n.º 3
0
class ManageLogger(QtCore.QObject):

    show_status = QtCore.pyqtSignal(bool, str)

    def __init__(self, sysbus, parent=None):
        super(ManageLogger, self).__init__()
        self.logmgr = LogManager(SERVICE,
                                 sysbus,
                                 self.show_status)
        self.show_status.connect(self.status_message)
        self.logmgr.show_level.connect(self.proc_level)
        self.logmgr.show_components.connect(self.proc_components)

    def get_level(self, component):
        self.logmgr.Get(component)
        print("Getting log level for %s" % (component))

    def set_level(self, component, level):
        self.logmgr.Set(component, level)
        print("Setting log level for %s to %s" % (component, level))

    def getall(self):
        self.logmgr.GetAll()
        print("Fetching component log levels")

    def proc_level(self, level):
        print("Level = %s" % (level))
        sys.exit()

    def proc_components(self, components):
        print("dict of levels:")
        for comp in components.keys():
            print("Component %s is at %s" % (comp, components[comp]))
        sys.exit()

    def status_message(self, status, errormsg):
        print("Error: status = %s, %s" % (str(status), errormsg))
        sys.exit()