def applyConfig(self, ret = False): if ret: if self._cfgMounttype.value == 'nfs': data = iAutoMount.DEFAULT_OPTIONS_NFS else: data = iAutoMount.DEFAULT_OPTIONS_CIFS data['active'] = self._cfgActive.value data['ip'] = self._cfgIp.getText() data['sharename'] = re_sub("\W", "", self._cfgSharename.value) # "\W" matches everything that is "not numbers, letters, or underscores",where the alphabet defaults to ASCII. if self._cfgSharedir.value.startswith("/"): data['sharedir'] = self._cfgSharedir.value[1:] else: data['sharedir'] = self._cfgSharedir.value data['options'] = self._cfgOptions.value data['mounttype'] = self._cfgMounttype.value data['username'] = self._cfgUsername.value data['password'] = self._cfgPassword.value data['hdd_replacement'] = self._cfgHddReplacement.value self._applyConfigMsgBox = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait while I'm saving your network mount..."), type = MessageBox.TYPE_INFO, enable_input = False) iAutoMount.mounts[self._cfgSharename.value] = data iAutoMount.save() iAutoMount.reload(self.applyConfigDataAvail) else: self.close()
def _onMountRemoved(self, success): text = _("Your network mount has been removed.") if not success: text = _("Sorry! Your network mount has NOT been removed.") self.session.toastManager.showToast(text) iAutoMount.save() iAutoMount.reload(self._onMountsReloaded)
def finishedPing(self, _ret_val=None): logger.debug("shares_changed: %s", self.shares_changed) if self.shares_changed: iAutoMount.apply(self.shares_changed, self.onMountsChange) iAutoMount.save() else: self.check4InitComplete()
def applyConfig(self, ret=False): if ret == True: data = iAutoMount.DEFAULT_OPTIONS_NFS data['active'] = self._cfgActive.value data['ip'] = self._cfgIp.getText() data['sharename'] = re_sub("\W", "", self._cfgSharename.value) # "\W" matches everything that is "not numbers, letters, or underscores",where the alphabet defaults to ASCII. if self._cfgSharedir.value.startswith("/"): data['sharedir'] = self._cfgSharedir.value[1:] else: data['sharedir'] = self._cfgSharedir.value data['options'] = self._cfgOptions.value data['mounttype'] = self._cfgMounttype.value data['username'] = self._cfgUsername.value data['password'] = self._cfgPassword.value data['hdd_replacement'] = self._cfgHddReplacement.value self._applyConfigMsgBox = self.session.openWithCallback( self.applyConfigfinishedCB, MessageBox, _("Please wait while I'm saving your network mount..."), type=MessageBox.TYPE_INFO, enable_input=False) iAutoMount.mounts[self._cfgSharename.value] = data iAutoMount.save() iAutoMount.reload(self.applyConfigDataAvail) else: self.close()
def updateConfig(self, ret=False): if ret == True: sharedir = None if self._cfgSharedir.value.startswith("/"): sharedir = self._cfgSharedir.value[1:] else: sharedir = self._cfgSharedir.value sharename = self._cfgSharename.value iAutoMount.setMountAttributes( sharename, { "sharename": sharename, "active": self._cfgActive.value, "ip": self._cfgIp.getText(), "sharedir": sharedir, "mounttype": self._cfgMounttype.value, "options": self._cfgOptions.value, "username": self._cfgUsername.value, "password": self._cfgPassword.value, "hdd_replacement": self._cfgHddReplacement.value }) self._applyConfigMsgBox = self.session.openWithCallback( self.applyConfigfinishedCB, MessageBox, _("Please wait while updating your network mount..."), type=MessageBox.TYPE_INFO, enable_input=False) iAutoMount.save() iAutoMount.reload(self.applyConfigDataAvail) else: self.close()
def updateConfig(self, ret = False): if ret == True: sharedir = None if self._cfgSharedir.value.startswith("/"): sharedir = self._cfgSharedir.value[1:] else: sharedir = self._cfgSharedir.value sharename = self._cfgSharename.value iAutoMount.setMountAttributes(sharename, { "sharename" : sharename, "active" : self._cfgActive.value, "ip" : self._cfgIp.getText(), "sharedir" : sharedir, "mounttype" : self._cfgMounttype.value, "options" : self._cfgOptions.value, "username" : self._cfgUsername.value, "password" : self._cfgPassword.value, "hdd_replacement" : self._cfgHddReplacement.value }) self._applyConfigMsgBox = self.session.openWithCallback(self.applyConfigfinishedCB, MessageBox, _("Please wait while updating your network mount..."), type = MessageBox.TYPE_INFO, enable_input = False) iAutoMount.save() iAutoMount.reload(self.applyConfigDataAvail) else: self.close()
def removeDataAvail(self, data): if data is True: iAutoMount.save() iAutoMount.reload(self.deleteDataAvail)