Exemplo n.º 1
0
    def __init__(self, hw):
        self.hw = hw

        glade_file = "LcsHardware.glade"

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)

        xml_signal_autoconnect(
            self.xml, {
                "on_okButton_clicked": self.on_okButton_clicked,
                "on_cancelButton_clicked": self.on_cancelButton_clicked,
                "on_adapterEntry_changed": self.on_adapterEntry_changed
            })

        self.dialog = self.xml.get_widget("Dialog")
        self.dialog.connect("delete-event", self.on_Dialog_delete_event)
        load_icon("network.xpm", self.dialog)

        self.setup()
        self.hydrate()
Exemplo n.º 2
0
    def __init__(self, hw):
        glade_file = "modemconfig.glade"

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)

        xml_signal_autoconnect(
            self.xml, {
                "on_okButton_clicked": self.on_okButton_clicked,
                "on_cancelButton_clicked": self.on_cancelButton_clicked
            })

        self.dialog = self.xml.get_widget("Dialog")
        load_icon("network.xpm", self.dialog)

        self.hw = hw

        self.setup()
        self.hydrate()
Exemplo n.º 3
0
    def __init__(self, Name):
        self.Name = Name

        glade_file = "editdomain.glade"

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)

        xml_signal_autoconnect(
            self.xml, {
                "on_domainNameEntry_insert_text":
                (self.on_domainNameEntry_insert_text, ""),
                "on_okButton_clicked":
                self.on_okButton_clicked,
                "on_cancelButton_clicked":
                self.on_cancelButton_clicked
            })

        self.dialog = self.xml.get_widget("Dialog")
        #self.dialog.connect("delete-event", self.on_Dialog_delete_event)
        #self.dialog.connect("hide", gtk.main_quit)

        load_icon("network.xpm", self.dialog)
        self.setup()
        self.hydrate()
Exemplo n.º 4
0
    def __init__(self):
        glade_file = "hardwaretype.glade"

        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file, None, domain=PROGNAME)
        xml_signal_autoconnect(self.xml,
            {
            "on_okButton_clicked" : self.on_okButton_clicked,
            "on_cancelButton_clicked" : self.on_cancelButton_clicked,
            })

        self.dialog = self.xml.get_widget("Dialog")
        load_icon("network.xpm", self.dialog)
        self.Type = None
        machine = os.uname()[4]
        hardwarelist = NCHardwareList.getHardwareList()
        if machine == 's390' or machine == 's390x':
            devicetypes = [ ETHERNET, TOKENRING, QETH ]
        else:
            df = getHardwareFactory()
            devicetypes = df.keys()

        for hw in hardwarelist:
            if hw.Type == ISDN:
                devicetypes.remove(ISDN)
                break


        self.xml.get_widget(
            'hardwareTypeCombo').set_popdown_strings(devicetypes)
        self.hydrate()
Exemplo n.º 5
0
    def __init__(self, host):
        self.host = host

        glade_file = "edithosts.glade"

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)

        xml_signal_autoconnect(
            self.xml, {
                "on_addressEntry_insert_text":
                (self.on_generic_entry_insert_text, r"^[a-f:0-9\.]"),
                "on_hostnameEntry_insert_text":
                (self.on_generic_entry_insert_text, r"^[A-Za-z\-0-9\.]"),
                "on_aliasesEntry_insert_text":
                (self.on_generic_entry_insert_text, r"^[A-Za-z\- 0-9\.]"),
                "on_okButton_clicked":
                self.on_okButton_clicked,
                "on_cancelButton_clicked":
                self.on_cancelButton_clicked
            })

        self.dialog = self.xml.get_widget("Dialog")
        load_icon("network.xpm", self.dialog)
        self.hydrate()
Exemplo n.º 6
0
    def __init__(self, device, connection_type="isdn"):
        self.device = device
        self.done = False
        self.country = ""
        self.city = ""
        self.name = ""
        self.connection_type = connection_type
        self.provider = None

        glade_file = "ChooseProvider.glade"

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)

        # get the widgets we need
        self.dbtree = self.xml.get_widget("providerTree")
        self.dialog = self.xml.get_widget("Dialog")
        self.okButton = self.xml.get_widget("okButton")

        xml_signal_autoconnect(
            self.xml, {
                "on_okButton_clicked":
                self.on_okButton_clicked,
                "on_cancelButton_clicked":
                self.on_cancelButton_clicked,
                "on_providerTree_tree_select_row":
                self.on_providerTree_tree_select_row,
                "on_providerTree_button_press_event":
                (self.on_providerTree_button_press_event,
                 self.on_okButton_clicked),
                "on_providerTree_tree_unselect_row":
                self.on_providerTree_tree_unselect_row
            })

        self.okButton.set_sensitive(False)
        self.setup_provider_db()
        load_icon("network.xpm", self.dialog)
Exemplo n.º 7
0
    def __init__(self, hw, glade_file, signals=None, dialogname="Dialog"):
        self.hw = hw

        if not os.path.exists(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = GUI_functions.NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file,
                                 None,
                                 domain=GUI_functions.PROGNAME)
        if signals:
            xml_signal_autoconnect(self.xml, signals)

        self.dialog = self.xml.get_widget(dialogname)
        self.dialog.connect("delete-event", self.on_Dialog_delete_event)
        load_icon("network.xpm", self.dialog)

        self.setup()
        self.hydrate()
Exemplo n.º 8
0
    def __init__(self, glade_file, device):
        self.device = device

        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file, None, domain=PROGNAME)
        self.dialog = self.xml.get_widget("Dialog")
        xml_signal_autoconnect(
            self.xml, {
                "on_okButton_clicked": self.on_okButton_clicked,
                "on_notebook_switch_page": self.on_notebook_switch_page,
                "on_cancelButton_clicked": self.on_cancelButton_clicked,
            })

        glade_file = "sharedtcpip.glade"
        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.sharedtcpip_xml = gtk.glade.XML(glade_file, None, domain=PROGNAME)

        glade_file = "DeviceConfigDialog.glade"
        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.deviceconfig_xml = gtk.glade.XML(glade_file,
                                              None,
                                              domain=PROGNAME)

        xml_signal_autoconnect(
            self.deviceconfig_xml, {
                "on_deviceNameEntry_changed":
                self.on_deviceNameEntry_changed,
                "on_deviceNameEntry_insert_text":
                (self.on_generic_entry_insert_text, r"^[a-z|A-Z|0-9\_:]+$"),
            })

        #window = self.deviceconfig_xml.get_widget ('window')
        frame = self.deviceconfig_xml.get_widget('generalVbox')
        vbox = self.xml.get_widget('generalVbox')
        for child in vbox.get_children():
            vbox.remove(child)
        for child in frame.get_children():
            frame.remove(child)
            vbox.pack_start(child)

        vbox.show()
        #window.remove (frame)
        #vbox.pack_start (frame)

        self.xml.get_widget("okButton").set_sensitive(
            len(
                self.deviceconfig_xml.get_widget('deviceNameEntry').get_text())
            > 0)

        load_icon("network.xpm", self.dialog)

        self.hydrate()
    def __init__(self):
        glade_file = 'neat-control.glade'

        if not os.path.isfile(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.isfile(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.isRoot = False
        self.no_profileentry_update = False

        if os.access(getRoot() + "/", os.W_OK):
            self.isRoot = True

        self.xml = glade.XML(glade_file, None, domain=PROGNAME)

        xml_signal_autoconnect(self.xml,
            {
            'on_closeButton_clicked' : self.on_closeButton_clicked,
            'on_infoButton_clicked' : self.on_infoButton_clicked,
            'on_activateButton_clicked' : self.on_activateButton_clicked,
            'on_deactivateButton_clicked' : self.on_deactivateButton_clicked,
            'on_configureButton_clicked' : self.on_configureButton_clicked,
            'on_monitorButton_clicked' : self.on_monitorButton_clicked,
            'on_profileActivateButton_clicked' : \
            self.on_profileActivateButton_clicked,
                #            'on_autoSelectProfileButton_clicked' : \
                #            self.on_autoSelectProfileButton_clicked,
            'on_interfaceClist_select_row' : (\
            self.on_generic_clist_select_row,
            self.xml.get_widget('activateButton'),
            self.xml.get_widget('deactivateButton'),
            self.xml.get_widget('editButtonbutton'),
            self.xml.get_widget('monitorButton')),
            })

        self.dialog = self.xml.get_widget('mainWindow')
        self.dialog.connect('delete-event', self.on_Dialog_delete_event)
        self.dialog.connect('hide', gtk.main_quit)
        self.on_xpm, self.on_mask = get_icon('on.xpm')
        self.off_xpm, self.off_mask = get_icon('off.xpm')

        if not os.access('/usr/bin/rp3', os.X_OK):
            self.xml.get_widget('monitorButton').hide()

        load_icon('neat-control.xpm', self.dialog)
        pix = self.xml.get_widget('pixmap')
        pix.set_from_pixbuf(get_pixbuf('neat-control-logo.png'))
        clist = self.xml.get_widget('interfaceClist')
        clist.column_titles_passive()

        self.devicelist = self.getProfDeviceList()
        self.activedevicelist = NetworkDevice().get()
        self.hydrate()
        self.oldprofile = None
        self.xml.get_widget('profileActivateButton').set_sensitive(False)
        self.hydrateProfiles()

        self.xml.get_widget('autoSelectProfileButton').hide()

        self.tag = gobject.timeout_add(4000, self.update_dialog)
        # Let this dialog be in the taskbar like a normal window
        self.dialog.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NORMAL)
        self.dialog.show()
    def __init__(self, parent_dialog = None):
        self.creator = None
        glade_file = 'NewInterfaceDruid.glade'

        if not os.path.isfile(glade_file):
            glade_file = GUI_functions.GLADEPATH + glade_file
        if not os.path.isfile(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.xml = gtk.glade.XML (glade_file, 'toplevel',
                                  domain=GUI_functions.PROGNAME)

        # get the widgets we need
        self.toplevel = self.xml.get_widget ('toplevel')
        self.druid = self.xml.get_widget ('druid')
        self.start_page = self.xml.get_widget('start_page')
        self.interface_clist = self.xml.get_widget ('interface_clist')
        self.description_label = self.xml.get_widget ('description_label')

        if parent_dialog:
            self.toplevel.set_transient_for(parent_dialog)
            self.toplevel.set_position (gtk.WIN_POS_CENTER_ON_PARENT)
        else:
            self.toplevel.set_position (gtk.WIN_POS_CENTER)

        xml_signal_autoconnect (self.xml,
            { 'on_toplevel_delete_event' : self.on_cancel_interface,
              'on_druid_cancel' : self.on_cancel_interface,
              'on_start_page_prepare' : self.on_start_page_prepare,
              'on_start_page_next' : self.on_start_page_next,
              'on_interface_clist_select_row' : \
              self.on_interface_clist_select_row,
              })

        load_icon("network.xpm", self.toplevel)

        # Initialize the clist
        self.interface_clist.column_titles_passive ()
        self.interface_clist.set_row_height(20)

        self.interface_clist.clear()
        interfaces = []
        df = getDeviceFactory()
        dfk = df.keys()
        dfk.sort()
        for mtype in dfk:
            i = df.getDeviceClass(mtype)().getWizard()
            if i:
                interfaces.append(i)

        for iface_creator in interfaces:
            iface = iface_creator (self.toplevel, do_save = None,
                                   druid = self.druid)
            iftype = iface.get_type()
            row = self.interface_clist.append ( \
                [ iface.get_project_name () ] )

            device_pixmap, device_mask = \
                           GUI_functions.get_device_icon_mask(iftype,
                                                              self.toplevel)

            self.interface_clist.set_pixtext (row, 0,
                                              iface.get_project_name (), 5,
                                              device_pixmap, device_mask)

            self.interface_clist.set_row_data (row, iface)

        self.canceled = False

        self.interface_clist.select_row (0, 0)

        self.toplevel.show_all ()
        self.on_start_page_prepare (None, None)
    def __init__(self, device):
        self.device = device
        glade_file = "DeviceTypeDialog.glade"

        if not os.path.exists(glade_file):
            glade_file = GLADEPATH + glade_file
        if not os.path.exists(glade_file):
            glade_file = NETCONFDIR + glade_file

        self.xml = gtk.glade.XML(glade_file, None, domain=PROGNAME)
        xml_signal_autoconnect(
            self.xml, {
                "on_okButton_clicked": self.on_okButton_clicked,
                "on_cancelButton_clicked": self.on_cancelButton_clicked,
            })

        self.dialog = self.xml.get_widget("Dialog")
        load_icon("network.xpm", self.dialog)

        devicetypes = deviceTypes[:]
        devicetypes.remove(LO)

        hardwarelist = NCHardwareList.getHardwareList()
        machine = os.uname()[4]
        ethernetFound = False
        modemFound = False
        isdnFound = False
        tokenringFound = False
        adslFound = False
        wirelessFound = False
        for hw in hardwarelist:
            if hw.Type == MODEM:
                modemFound = True
            elif hw.Type == ISDN:
                isdnFound = True
            elif hw.Type == ETHERNET:
                ethernetFound = True
                adslFound = True
                wirelessFound = True
            elif hw.Type == TOKENRING:
                tokenringFound = True
        if machine == 's390' or machine == 's390x':
            modemFound = False
            isdnFound = False
            adslFound = False
            wirelessFound = False
        if not modemFound:
            devicetypes.remove(MODEM)
        if not isdnFound:
            devicetypes.remove(ISDN)
        if not ethernetFound:
            devicetypes.remove(ETHERNET)
        if not adslFound:
            devicetypes.remove(DSL)
        if not tokenringFound:
            devicetypes.remove(TOKENRING)
        if not wirelessFound:
            devicetypes.remove(WIRELESS)

        omenu = self.xml.get_widget('deviceTypeOption')
        omenu.remove_menu()
        menu = gtk.Menu()
        for device_name in devicetypes:
            menu_item = gtk.MenuItem(device_name)
            menu_item.set_data("device", device_name)
            menu_item.show()
            menu.append(menu_item)
        menu.show()
        omenu.set_menu(menu)
        omenu.grab_focus()
        self.hydrate()