示例#1
0
    def openMountEdit(self, selection):
        if selection is not None and len(selection):
            mounts = iAutoMount.getMountsList()
            if selection[0] == 'nfsShare':
                data = {'isMounted': False,
                 'active': False,
                 'ip': False,
                 'sharename': False,
                 'sharedir': False,
                 'username': False,
                 'password': False,
                 'mounttype': False,
                 'options': False}
                data['mounttype'] = 'nfs'
                data['active'] = True
                data['ip'] = selection[2]
                data['sharename'] = selection[1]
                data['sharedir'] = selection[4]
                data['options'] = 'rw,nolock,tcp'
                for (sharename, sharedata,) in mounts.items():
                    if sharedata['ip'] == selection[2] and sharedata['sharedir'] == selection[4]:
                        data = sharedata

                self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
            if selection[0] == 'smbShare':
                data = {'isMounted': False,
                 'active': False,
                 'ip': False,
                 'sharename': False,
                 'sharedir': False,
                 'username': False,
                 'password': False,
                 'mounttype': False,
                 'options': False}
                data['mounttype'] = 'cifs'
                data['active'] = True
                data['ip'] = selection[2]
                data['sharename'] = selection[3] + '@' + selection[1]
                data['sharedir'] = selection[3]
                data['options'] = 'rw'
                self.sharecache_file = None
                self.sharecache_file = '/etc/enigma2/' + selection[1].strip() + '.cache'
                if os_path.exists(self.sharecache_file):
                    print '[Networkbrowser] Loading userinfo from ',
                    print self.sharecache_file
                    try:
                        self.hostdata = load_cache(self.sharecache_file)
                        data['username'] = self.hostdata['username']
                        data['password'] = self.hostdata['password']
                    except:
                        data['username'] = '******'
                        data['password'] = '******'
                else:
                    data['username'] = '******'
                    data['password'] = '******'
                for (sharename, sharedata,) in mounts.items():
                    if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] == selection[3].strip():
                        data = sharedata

                self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
示例#2
0
	def updateNetworkList(self):
		self.list = []
		self.network = {}
		self.mounts = iAutoMount.getMountsList() # reloading mount list
		for x in self.networklist:
			if not self.network.has_key(x[2]):
				self.network[x[2]] = []
			self.network[x[2]].append((NetworkDescriptor(name = x[1], description = x[2]), x))
		self.network.keys().sort()
		for x in self.network.keys():
			if self.network[x][0][1][3] == '00:00:00:00:00:00':
				self.device = 'unix'
			else:
				self.device = 'windows'
			if x in self.expanded:
				networkshares = self.getNetworkShares(x,self.network[x][0][1][1].strip(),self.device)
				hostentry = self.network[x][0][1]
				name = hostentry[2] + " ( " +hostentry[1].strip() + " )"
				expandedIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png"))
				self.list.append(( hostentry, expandedIcon, name, None, None, None, None ))
				for share in networkshares:
					self.list.append(self.BuildNetworkShareEntry(share))
			else: # HOSTLIST - VIEW
				hostentry = self.network[x][0][1]
				name = hostentry[2] + " ( " +hostentry[1].strip() + " )"
				expandableIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png"))
				self.list.append(( hostentry, expandableIcon, name, None, None, None, None ))
		if len(self.list):
			for entry in self.list:
				entry[0][2]= "%3s.%3s.%3s.%3s" % tuple(entry[0][2].split("."))
			self.list.sort(key=lambda x: x[0][2])
			for entry in self.list:
				entry[0][2]= entry[0][2].replace(" ", "")
		self["list"].setList(self.list)
		self["list"].setIndex(self.listindex)
示例#3
0
    def openMountEdit(self, selection):
        if selection is not None and len(selection):
            mounts = iAutoMount.getMountsList()
            if selection[0] == 'nfsShare':
                data = {'isMounted': False,
                 'active': False,
                 'ip': False,
                 'sharename': False,
                 'sharedir': False,
                 'username': False,
                 'password': False,
                 'mounttype': False,
                 'options': False}
                data['mounttype'] = 'nfs'
                data['active'] = True
                data['ip'] = selection[2]
                data['sharename'] = selection[1]
                data['sharedir'] = selection[4]
                data['options'] = 'rw,nolock,tcp'
                for (sharename, sharedata,) in mounts.items():
                    if sharedata['ip'] == selection[2] and sharedata['sharedir'] == selection[4]:
                        data = sharedata

                self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
            if selection[0] == 'smbShare':
                data = {'isMounted': False,
                 'active': False,
                 'ip': False,
                 'sharename': False,
                 'sharedir': False,
                 'username': False,
                 'password': False,
                 'mounttype': False,
                 'options': False}
                data['mounttype'] = 'cifs'
                data['active'] = True
                data['ip'] = selection[2]
                data['sharename'] = selection[3] + '@' + selection[1]
                data['sharedir'] = selection[3]
                data['options'] = 'rw'
                self.sharecache_file = None
                self.sharecache_file = '/etc/enigma2/' + selection[1].strip() + '.cache'
                if os_path.exists(self.sharecache_file):
                    print '[Networkbrowser] Loading userinfo from ',
                    print self.sharecache_file
                    try:
                        self.hostdata = load_cache(self.sharecache_file)
                        data['username'] = self.hostdata['username']
                        data['password'] = self.hostdata['password']
                    except:
                        data['username'] = '******'
                        data['password'] = '******'
                else:
                    data['username'] = '******'
                    data['password'] = '******'
                for (sharename, sharedata,) in mounts.items():
                    if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] == selection[3].strip():
                        data = sharedata

                self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
示例#4
0
 def showMountsList(self):
         self.list = []
         self.mounts = iAutoMount.getMountsList()
         for sharename in self.mounts.keys():
                 mountentry = iAutoMount.automounts[sharename]
                 self.list.append(self.buildMountViewItem(mountentry))
         self["config"].setList(self.list)
	def updateNetworkList(self):
		self.list = []
		self.network = {}
		self.mounts = iAutoMount.getMountsList()  # reloading mount list
		for x in self.networklist:
			if not x[2] in self.network:
				self.network[x[2]] = []
			self.network[x[2]].append((NetworkDescriptor(name=x[1], description=x[2]), x))
		self.network.keys().sort()
		for x in self.network.keys():
			hostentry = self.network[x][0][1]
			name = hostentry[2] + " ( " + hostentry[1].strip() + " )"
			if os.path.exists(resolveFilename(SCOPE_ACTIVE_SKIN, "networkbrowser/host.png")):
				hostIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_ACTIVE_SKIN, "networkbrowser/host.png"))
			else:
				hostIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png"))
			self.list.append((hostentry, hostIcon, name, None, None, None, None, None))
			if x in self.expanded:
				for share in self.expanded[x]:
					self.list.append(self.BuildNetworkShareEntry(share))
		if len(self.list):
			for entry in self.list:
				entry[0][2] = "%3s.%3s.%3s.%3s" % tuple(entry[0][2].split("."))
			self.list.sort(key=lambda x: x[0][2])
			for entry in self.list:
				entry[0][2] = entry[0][2].replace(" ", "")
		self["list"].setList(self.list)
		self["list"].setIndex(self.listindex)
示例#6
0
	def __init__(self, session, plugin_path, mountinfo = None ):
		self.skin_path = plugin_path
		self.session = session
		Screen.__init__(self, self.session)

		self.mountinfo = mountinfo
		if self.mountinfo is None:
			#Initialize blank mount enty
			self.mountinfo = { 'isMounted': False, 'active': False, 'ip': False, 'host': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False, 'hdd_replacement' : False }

		self.applyConfigRef = None
		self.updateConfigRef = None
		self.mounts = iAutoMount.getMountsList()
		self.createConfig()

		self["actions"] = NumberActionMap(["SetupActions"],
		{
			"ok": self.ok,
			"back": self.close,
			"cancel": self.close,
			"red": self.close,
		}, -2)

		self.list = []
		ConfigListScreen.__init__(self, self.list, session = self.session)
		self.createSetup()
		self.onLayoutFinish.append(self.layoutFinished)
		# Initialize Buttons
		self["VKeyIcon"] = Boolean(False)
		self["HelpWindow"] = Pixmap()
		self["HelpWindow"].hide()
		self["introduction"] = StaticText(_("Press OK to activate the settings."))
		self["key_red"] = StaticText(_("Cancel"))
示例#7
0
 def showMountsList(self):
     self.list = []
     self.mounts = iAutoMount.getMountsList()
     for sharename in self.mounts.keys():
         mountentry = iAutoMount.automounts[sharename]
         self.list.append(self.buildMountViewItem(mountentry))
     self["config"].setList(self.list)
	def updateNetworkList(self):
		self.list = []
		self.network = {}
		self.mounts = iAutoMount.getMountsList() # reloading mount list
		for x in self.networklist:
			if not self.network.has_key(x[2]):
				self.network[x[2]] = []
			self.network[x[2]].append((NetworkDescriptor(name = x[1], description = x[2]), x))
		self.network.keys().sort()
		for x in self.network.keys():
			if self.network[x][0][1][3] == '00:00:00:00:00:00':
				self.device = 'unix'
			else:
				self.device = 'windows'
			if x in self.expanded:
				networkshares = self.getNetworkShares(x,self.network[x][0][1][1].strip(),self.device)
				hostentry = self.network[x][0][1]
				name = hostentry[2] + " ( " +hostentry[1].strip() + " )"
				expandedIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png"))
				self.list.append(( hostentry, expandedIcon, name, None, None, None, None, None ))
				for share in networkshares:
					self.list.append(self.BuildNetworkShareEntry(share))
			else: # HOSTLIST - VIEW
				hostentry = self.network[x][0][1]
				name = hostentry[2] + " ( " +hostentry[1].strip() + " )"
				expandableIcon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_PLUGINS, "SystemPlugins/NetworkBrowser/icons/host.png"))
				self.list.append(( hostentry, expandableIcon, name, None, None, None, None, None ))
		if len(self.list):
			for entry in self.list:
				entry[0][2]= "%3s.%3s.%3s.%3s" % tuple(entry[0][2].split("."))
			self.list.sort(key=lambda x: x[0][2])
			for entry in self.list:
				entry[0][2]= entry[0][2].replace(" ", "")
		self["list"].setList(self.list)
		self["list"].setIndex(self.listindex)
示例#9
0
    def openMountEdit(self, selection):
        if selection is not None and len(selection):
            mounts = iAutoMount.getMountsList()
            newmount = True
            # Initialize blank mount entry
            data = {
                'isMounted': False,
                'active': True,
                'ip': selection[2],
                'sharename': False,
                'sharedir': False,
                'username': False,
                'password': False,
                'options': False
            }
            if selection[0] == 'nfsShare':
                # add data
                data['mounttype'] = 'nfs'
                data['options'] = default_mount_options['nfs']
                data['sharename'] = (selection[1] or selection[2]) + '_' + (
                    os.path.basename(selection[4]) or "root")

                data['sharedir'] = selection[4]

                for sharename, sharedata in mounts.items():
                    if sharedata['ip'] == selection[2] and sharedata[
                            'sharedir'] in selection[4]:
                        data = sharedata
                        newmount = False
            elif selection[0] == 'smbShare':

                # add data
                data['mounttype'] = 'cifs'
                data['options'] = default_mount_options['cifs']
                data['sharename'] = (selection[1]
                                     or selection[2]) + '_' + selection[3]

                data['sharedir'] = selection[3]

                data['username'] = ""
                data['password'] = ""
                self.sharecache_file = '/etc/enigma2/' + selection[2].strip(
                ) + '.cache'
                if os.path.exists(self.sharecache_file):
                    print '[Networkbrowser] Loading userinfo from ', self.sharecache_file
                    try:
                        self.hostdata = load_cache(self.sharecache_file)
                        data['username'] = self.hostdata['username']
                        data['password'] = self.hostdata['password']
                    except:
                        pass
                for sharename, sharedata in mounts.items():
                    if sharedata['ip'] == selection[2].strip(
                    ) and sharedata['sharedir'] in selection[3].strip():
                        data = sharedata
                        newmount = False
            self.session.openWithCallback(self.MountEditClosed, AutoMountEdit,
                                          self.skin_path, data, newmount)
	def startRun(self):
		self.expanded = []
		self.setStatus('update')
		self.mounts = iAutoMount.getMountsList()
		self["infotext"].setText("")
		self.vc = valid_cache(self.cache_file, self.cache_ttl)
		if self.cache_ttl > 0 and self.vc != 0:
			self.process_NetworkIPs()
		else:
			self.Timer.start(3000)
示例#11
0
    def showMountsList(self):
        self.list = []
        self.mounts = iAutoMount.getMountsList()
        for sharename in self.mounts.keys():
            mountentry = iAutoMount.automounts[sharename]
            self.list.append(self.buildMountViewItem(mountentry))

        self['config'].setList(self.list)
        self['config'].list.sort()
        self['config'].onSelectionChanged.append(self.selectionChanged)
 def startRun(self):
     self.expanded = []
     self.setStatus('update')
     self.mounts = iAutoMount.getMountsList()
     self["infotext"].setText("")
     self.vc = valid_cache(self.cache_file, self.cache_ttl)
     if self.cache_ttl > 0 and self.vc != 0:
         self.process_NetworkIPs()
     else:
         self.Timer.start(3000)
示例#13
0
    def __init__(self, session, plugin_path, mountinfo=None, newmount=True):
        self.skin_path = plugin_path
        self.session = session
        Screen.__init__(self, self.session)

        self.onChangedEntry = []
        self.mountinfo = mountinfo
        self.newmount = newmount
        if self.mountinfo is None:
            #Initialize blank mount enty
            self.mountinfo = {
                'isMounted': False,
                'mountusing': False,
                'active': False,
                'ip': False,
                'sharename': False,
                'sharedir': False,
                'username': False,
                'password': False,
                'mounttype': False,
                'options': False,
                'hdd_replacement': False
            }

        self.applyConfigRef = None
        self.updateConfigRef = None
        self.mounts = iAutoMount.getMountsList()
        self.createConfig()

        self["actions"] = NumberActionMap(
            ["SetupActions", "ColorActions"], {
                "ok": self.ok,
                "back": self.close,
                "cancel": self.close,
                "red": self.close,
                "green": self.ok,
            }, -2)

        self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], {
            "showVirtualKeyboard": self.KeyText,
        }, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=self.session)
        self.createSetup()
        self.onLayoutFinish.append(self.layoutFinished)
        # Initialize Buttons
        self["VKeyIcon"] = Pixmap()
        self["HelpWindow"] = Pixmap()
        self["introduction"] = StaticText(
            _("Press OK to activate the settings."))
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self.selectionChanged()
	def openMountEdit(self, selection):
		if selection is not None and len(selection):
			mounts = iAutoMount.getMountsList()
			newmount = True
			if selection[0] == 'nfsShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'nfs'
				data['active'] = True
				data['ip'] = selection[2]

				data['sharename'] = selection[1]
				data['sharedir'] = selection[4]
				data['options'] = "rw,nolock,tcp"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2] and sharedata['sharedir'] in selection[4]:
						data = sharedata
						newmount = False
			elif selection[0] == 'smbShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'cifs'
				data['active'] = True
				data['ip'] = selection[2]
				data['sharename'] = selection[3] + "@" + selection[1]
				data['sharedir'] = selection[3]
				data['options'] = "rw,utf8"
				self.sharecache_file = None
				self.sharecache_file = '/etc/enigma2/' + selection[1].strip() + '.cache' #Path to cache directory
				if os_path.exists(self.sharecache_file):
					print '[Networkbrowser] Loading userinfo from ',self.sharecache_file
					try:
						self.hostdata = load_cache(self.sharecache_file)
						data['username'] = self.hostdata['username']
						data['password'] = self.hostdata['password']
					except:
						data['username'] = "******"
						data['password'] = "******"
				else:
					data['username'] = "******"
					data['password'] = "******"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] in selection[3].strip():
						data = sharedata
						newmount = False
			self.session.openWithCallback(self.MountEditClosed,AutoMountEdit, self.skin_path, data, newmount)
示例#15
0
	def openMountEdit(self, selection):
		if selection is not None and len(selection):
			mounts = iAutoMount.getMountsList()
			newmount = True
			# Initialize blank mount entry
			data = {
				'isMounted': False,
				'active': True,
				'ip': selection[2],
				'sharename': False,
				'sharedir': False,
				'username': False,
				'password': False,
				'options': False
			}
			if selection[0] == 'nfsShare':
				# add data
				data['mounttype'] = 'nfs'
				data['sharename'] = (selection[1] or selection[2]) + '_' + (os.path.basename(selection[4]) or "root")
				data['sharedir'] = selection[4]
				data['options'] = "rw,nolock,tcp"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2] and sharedata['sharedir'] in selection[4]:
						data = sharedata
						newmount = False
			elif selection[0] == 'smbShare':
				# add data
				data['mounttype'] = 'cifs'
				data['sharename'] = (selection[1] or selection[2]) + '_' + selection[3]
				data['sharedir'] = selection[3]
				data['options'] = "rw,utf8,vers=2.1"
				data['username'] = ""
				data['password'] = ""
				self.sharecache_file = '/etc/enigma2/' + selection[2].strip() + '.cache'
				if os.path.exists(self.sharecache_file):
					print '[Networkbrowser] Loading userinfo from ', self.sharecache_file
					try:
						self.hostdata = load_cache(self.sharecache_file)
						data['username'] = self.hostdata['username']
						data['password'] = self.hostdata['password']
					except:
						pass
				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] in selection[3].strip():
						data = sharedata
						newmount = False
			self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data, newmount)
示例#16
0
    def __init__(self, session, plugin_path, mountinfo=None, newmount=True):
        self.skin_path = plugin_path
        self.session = session
        Screen.__init__(self, self.session)

        self.onChangedEntry = []
        self.mountinfo = mountinfo
        self.newmount = newmount
        if self.mountinfo is None:
            # Initialize blank mount enty
            self.mountinfo = {
                "isMounted": False,
                "mountusing": False,
                "active": False,
                "ip": False,
                "sharename": False,
                "sharedir": False,
                "username": False,
                "password": False,
                "mounttype": False,
                "options": False,
                "hdd_replacement": False,
            }

        self.applyConfigRef = None
        self.updateConfigRef = None
        self.mounts = iAutoMount.getMountsList()
        self.createConfig()

        self["actions"] = NumberActionMap(
            ["SetupActions", "ColorActions"],
            {"ok": self.ok, "back": self.close, "cancel": self.close, "red": self.close, "green": self.ok},
            -2,
        )

        self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"], {"showVirtualKeyboard": self.KeyText}, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list, session=self.session)
        self.createSetup()
        self.onLayoutFinish.append(self.layoutFinished)
        # Initialize Buttons
        self["VKeyIcon"] = Pixmap()
        self["HelpWindow"] = Pixmap()
        self["introduction"] = StaticText(_("Press OK to activate the settings."))
        self["key_red"] = StaticText(_("Cancel"))
        self["key_green"] = StaticText(_("Save"))
        self.selectionChanged()
示例#17
0
	def openMountEdit(self, selection):
		if selection is not None and len(selection):
			mounts = iAutoMount.getMountsList()
			if selection[0] == 'nfsShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'nfs'
				data['active'] = True
				data['ip'] = selection[2]
				data['sharename'] = selection[1]
				data['sharedir'] = selection[4]
				data['options'] = "rw,nolock,tcp"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2] and sharedata['sharedir'] == selection[4]:
						data = sharedata
				self.session.openWithCallback(self.MountEditClosed,AutoMountEdit, self.skin_path, data)
			if selection[0] == 'smbShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'cifs'
				data['active'] = True
				data['ip'] = selection[2]
				data['sharename'] = selection[1]
				data['sharedir'] = selection[3]
				data['options'] = "rw"
				self.sharecache_file = None
				self.sharecache_file = '/etc/enigma2/' + selection[1].strip() + '.cache' #Path to cache directory
				if os_path.exists(self.sharecache_file):
					print '[Networkbrowser] Loading userinfo from ',self.sharecache_file
					try:
						self.hostdata = load_cache(self.sharecache_file)
						data['username'] = self.hostdata['username']
						data['password'] = self.hostdata['password']
					except:
						data['username'] = "******"
						data['password'] = "******"
				else:
					data['username'] = "******"
					data['password'] = "******"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] == selection[3].strip():
						data = sharedata
				self.session.openWithCallback(self.MountEditClosed,AutoMountEdit, self.skin_path, data)
示例#18
0
	def openMountEdit(self, selection):
		if selection:
			mounts = iAutoMount.getMountsList()
			if selection[0] == 'nfsShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'nfs'
				data['active'] = True
				data['ip'] = selection[2]
				data['sharename'] = selection[1]
				data['sharedir'] = selection[4]
				data['options'] = "rw,nolock,tcp"

				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2] and sharedata['sharedir'] == selection[4]:
						data = sharedata
				self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
			if selection[0] == 'smbShare': # share entry selected
				#Initialize blank mount enty
				data = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False }
				# add data
				data['mounttype'] = 'cifs'
				data['active'] = True
				data['ip'] = selection[2]
				# Using the host name will only work if NetBIOS name lookup (aka "wins") is installed and actually working
				# data['host'] = selection[1]
				data['sharename'] = selection[3] + "@" + selection[1]
				data['sharedir'] = selection[3]
				data['options'] = "rw,utf8,vers=3.0"
				self.sharecache_file = '/etc/enigma2/' + selection[1].strip() + '.cache' #Path to cache directory
				data['username'] = "******"
				data['password'] = "******"
				try:
					hostdata = load_cache(self.sharecache_file)
					data['username'] = hostdata['username']
					data['password'] = hostdata['password']
				except:
					pass
				for sharename, sharedata in mounts.items():
					if sharedata['ip'] == selection[2].strip() and sharedata['sharedir'] == selection[3].strip():
						data = sharedata
				self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data)
示例#19
0
    def updateNetworkList(self):
        self.list = []
        self.network = {}
        self.mounts = iAutoMount.getMountsList()  # reloading mount list
        for x in self.networklist:
            if x[2] not in self.network:
                self.network[x[2]] = []
            self.network[x[2]].append((NetworkDescriptor(name=x[1],
                                                         description=x[2]), x))
        self.network.keys().sort()
        for x in self.network.keys():

            hostentry = self.network[x][0][1]
            name = hostentry[2] + " ( " + hostentry[1].strip() + " )"
            if os.path.exists(
                    resolveFilename(SCOPE_ACTIVE_SKIN,
                                    "networkbrowser/host.png")):
                hostIcon = LoadPixmap(cached=True,
                                      path=resolveFilename(
                                          SCOPE_ACTIVE_SKIN,
                                          "networkbrowser/host.png"))
            else:
                hostIcon = LoadPixmap(
                    cached=True,
                    path=resolveFilename(
                        SCOPE_PLUGINS,
                        "SystemPlugins/NetworkBrowser/icons/host.png"))
            self.list.append(
                (hostentry, hostIcon, name, None, None, None, None, None))
            if x in self.expanded:
                for share in self.expanded[x]:
                    self.list.append(self.BuildNetworkShareEntry(share))

        if len(self.list):
            for entry in self.list:
                entry[0][2] = "%3s.%3s.%3s.%3s" % tuple(entry[0][2].split("."))
            self.list.sort(key=lambda x: x[0][2])
            for entry in self.list:
                entry[0][2] = entry[0][2].replace(" ", "")
        self["list"].setList(self.list)
        self["list"].setIndex(self.listindex)
示例#20
0
 def __init__(self, session, plugin_path, mountinfo = None):
     self.skin_path = plugin_path
     self.session = session
     Screen.__init__(self, self.session)
     self.onChangedEntry = []
     self.mountinfo = mountinfo
     if self.mountinfo is None:
         self.mountinfo = {'isMounted': False,
          'mountusing': False,
          'active': False,
          'ip': False,
          'sharename': False,
          'sharedir': False,
          'username': False,
          'password': False,
          'mounttype': False,
          'options': False,
          'hdd_replacement': False}
     self.applyConfigRef = None
     self.updateConfigRef = None
     self.mounts = iAutoMount.getMountsList()
     self.createConfig()
     self['actions'] = NumberActionMap(['SetupActions', 'ColorActions'], {'ok': self.ok,
      'back': self.close,
      'cancel': self.close,
      'red': self.close,
      'green': self.ok}, -2)
     self['VirtualKB'] = ActionMap(['VirtualKeyboardActions'], {'showVirtualKeyboard': self.KeyText}, -2)
     self.list = []
     ConfigListScreen.__init__(self, self.list, session=self.session)
     self.createSetup()
     self.onLayoutFinish.append(self.layoutFinished)
     self['VKeyIcon'] = Pixmap()
     self['HelpWindow'] = Pixmap()
     self['introduction'] = StaticText(_('Press OK to activate the settings.'))
     self['key_red'] = StaticText(_('Cancel'))
     self['key_green'] = StaticText(_('Save'))
     self.selectionChanged()
示例#21
0
    def __init__(self, session, plugin_path, mountinfo = None ):
        self.skin_path = plugin_path
        self.session = session
        Screen.__init__(self, self.session)

        self.mountinfo = mountinfo
        if self.mountinfo is None:
            #Initialize blank mount enty
            self.mountinfo = { 'isMounted': False, 'active': False, 'ip': False, 'sharename': False, 'sharedir': False, 'username': False, 'password': False, 'mounttype' : False, 'options' : False, 'hdd_replacement' : False }

        self.applyConfigRef = None
        self.updateConfigRef = None
        self.mounts = iAutoMount.getMountsList()
        self.createConfig()

        self["actions"] = NumberActionMap(["SetupActions"],
            {
            "ok": self.ok,
            "back": self.close,
            "cancel": self.close,
            "red": self.close,
            }, -2)

        self["VirtualKB"] = ActionMap(["VirtualKeyboardActions"],
        {
            "showVirtualKeyboard": self.KeyText,
        }, -2)

        self.list = []
        ConfigListScreen.__init__(self, self.list,session = self.session)
        self.createSetup()
        self.onLayoutFinish.append(self.layoutFinished)
        # Initialize Buttons
        self["VKeyIcon"] = Pixmap()
        self["HelpWindow"] = Pixmap()
        self["introduction"] = StaticText(_("Press OK to activate the settings."))
        self["key_red"] = StaticText(_("Cancel"))
    def openMountEdit(self, selection):
        if selection is not None and len(selection):
            mounts = iAutoMount.getMountsList()
            newmount = True
            if selection[0] == "nfsShare":  # share entry selected
                # Initialize blank mount enty
                data = {
                    "isMounted": False,
                    "active": False,
                    "ip": False,
                    "sharename": False,
                    "sharedir": False,
                    "username": False,
                    "password": False,
                    "mounttype": False,
                    "options": False,
                }
                # add data
                data["mounttype"] = "nfs"
                data["active"] = True
                data["ip"] = selection[2]

                data["sharename"] = selection[1]
                data["sharedir"] = selection[4]
                data["options"] = "rw,nolock,tcp"

                for sharename, sharedata in mounts.items():
                    if sharedata["ip"] == selection[2] and sharedata["sharedir"] in selection[4]:
                        data = sharedata
                        newmount = False
            elif selection[0] == "smbShare":  # share entry selected
                # Initialize blank mount enty
                data = {
                    "isMounted": False,
                    "active": False,
                    "ip": False,
                    "sharename": False,
                    "sharedir": False,
                    "username": False,
                    "password": False,
                    "mounttype": False,
                    "options": False,
                }
                # add data
                data["mounttype"] = "cifs"
                data["active"] = True
                data["ip"] = selection[2]
                data["sharename"] = selection[3] + "@" + selection[1]
                data["sharedir"] = selection[3]
                data["options"] = "rw,utf8"
                self.sharecache_file = None
                self.sharecache_file = "/etc/enigma2/" + selection[1].strip() + ".cache"  # Path to cache directory
                if os_path.exists(self.sharecache_file):
                    print "[Networkbrowser] Loading userinfo from ", self.sharecache_file
                    try:
                        self.hostdata = load_cache(self.sharecache_file)
                        data["username"] = self.hostdata["username"]
                        data["password"] = self.hostdata["password"]
                    except:
                        data["username"] = "******"
                        data["password"] = "******"
                else:
                    data["username"] = "******"
                    data["password"] = "******"

                for sharename, sharedata in mounts.items():
                    if sharedata["ip"] == selection[2].strip() and sharedata["sharedir"] in selection[3].strip():
                        data = sharedata
                        newmount = False
            self.session.openWithCallback(self.MountEditClosed, AutoMountEdit, self.skin_path, data, newmount)