Esempio n. 1
0
	def apply_hostname_change(self):

		# INTERFACE TO CHANGE THE HOSTNAME
		try:

			log('changing hostname to %s' % self.device_name.replace('current name: ', ''))
			xbmc.sethostname(self.device_name.replace('current name: ', '')) 

		except:

			log('hostname change failed')
			log(traceback.format_exc())
Esempio n. 2
0
	def apply_hostname_change(self):

		# INTERFACE TO CHANGE THE HOSTNAME
		try:

			log('changing hostname to %s' % self.device_name.replace('current name: ', ''))
			xbmc.sethostname(self.device_name.replace('current name: ', '')) 

		except:

			log('hostname change failed')
			log(traceback.format_exc())
Esempio n. 3
0
	def onClick(self, controlID):

		if   controlID == 1005:				# Exit control

			self.exit_proceedure()

		elif controlID == 20010:			# language container

			self.previous_language = self.selected_language

			self.selected_language = self.getControl(controlID).getSelectedItem().getLabel()

			# display confirmation dialog
			user_confirmation = DIALOG.yesno('Confirm', self.selected_language, autoclose=10000)

			if user_confirmation == True:
				# if user CONFIRMS, check whether a skin reload is required

				if 'english' not in self.selected_language.lower():
					# if skin reload required, then close the window, change system language, reload the window and jump to TERMS
					
					# when lang_rerun set is True, the walkthru is reloaded and skips to the setting after language
					self.lang_rerun = True
					self.close()

				else:
					# jump to the setting AFTER language
					self.bypass_language()

			else:
				# if not, then revert to the previous_language
				self.selected_language = self.previous_language

		elif controlID in [30010, 30020, 30030,	30040, 30050, 30060, 30070, 30080, 30090]: # timezone containers
			
			# user has clicked on a timezone
			self.selected_country = self.getControl(controlID).getSelectedItem().getLabel()

			self.getControl(93000).setVisible(False)
			self.getControl(125000).setVisible(True)
			self.getControl(10035).setVisible(True)
			self.setFocusId(350010)

			# move on to choosing the hostname

		elif controlID in [350010]:		# choosing the hostname

			# show keyboard
			kb = xbmc.Keyboard(self.device_name.replace('current name: ', ''), 'Name your device')

			kb.doModal()

			# only move on if the device has been given a name
			if kb.isConfirmed():

				self.device_name = kb.getText()

				self.getControl(350010).setLabel('current name: ' + self.device_name.replace('_',''))

				self.getControl(350012).setVisible(True)

		elif controlID in [350011]:	# user has asked for a random name

			self.device_name = self.random_name()

			self.getControl(350010).setLabel('current name: ' + self.device_name)

			self.getControl(350012).setVisible(True)

		elif controlID in [350012]: # user has accepted the hostname

			# INTERFACE TO CHANGE THE HOSTNAME
			try:
				log('changing hostname to %s' % self.device_name.replace('current name: ', ''))
				xbmc.sethostname(self.device_name.replace('current name: ', '')) 
			except:
				log('hostname change failed')
				log(traceback.format_exc())

			# user has chosen a hostname
			self.getControl(125000).setVisible(False)
			self.getControl(94000).setVisible(True)
			self.getControl(1004).setVisible(True)
			self.setFocusId(40010)

		elif controlID == 40010:			# terms and conditions I Agree button
			

			if self.vero:		# show the warranty panel

				self.getControl(94000).setVisible(False)
				self.getControl(97000).setVisible(True)
				self.getControl(1007).setVisible(True)
				self.setFocusId(70010)

			else:

				self.networking_page_director(controlID)
	
		elif controlID == 70010:			# warranty I Agree button
			

			if self.vero:

				self.networking_page_director(controlID)

				self.getControl(97000).setVisible(False)
				self.getControl(98000).setVisible(True)
				self.getControl(1008).setVisible(True)
				self.setFocusId(80010)

			else:
				pass							

		elif controlID == 40020:			# unused scroll bar for TandC		

			self.getControl(555).scroll(10)

		elif controlID == 40030:			# unused scroll bar for TandC
			
			self.getControl(555).scroll(-10)

		elif controlID == 60090:			# skip networking button

			# display the skin panel
			# -- SUPPRESSED WHILE THE SKIN CHANGE METHOD IS WORKED ON --
			self.getControl(96000).setVisible(False)
			self.getControl(98000).setVisible(True)
			self.getControl(1008).setVisible(True)
			self.setFocusId(80010)	

			# display the sign-up panel
			# -- INCLUDED ONLY WHILE THE SKIN CHANGE METHOD IS WORKED ON --
			# self.getControl(96000).setVisible(False)
			# self.getControl(99000).setVisible(True)
			# self.getControl(1009).setVisible(True)
			# self.setFocusId(90010)

		elif controlID == 60010:			# open networking gui
			
			self.net_call.run(False)

			# display the skin panel  
			# -- SUPPRESSED WHILE THE SKIN CHANGE METHOD IS WORKED ON --
			self.getControl(96000).setVisible(False)
			self.getControl(98000).setVisible(True)
			self.getControl(1008).setVisible(True)
			self.setFocusId(80010)	

			# display the sign-up panel
			# -- INCLUDED ONLY WHILE THE SKIN CHANGE METHOD IS WORKED ON --
			# self.getControl(96000).setVisible(False)
			# self.getControl(99000).setVisible(True)
			# self.getControl(1009).setVisible(True)
			# self.setFocusId(90010)

		elif controlID in [80010, 80020]:	# user has selected a skin

			# -- THIS SECTION IS SUPPRESSED WHILE THE SKIN CHANGE METHOD IS WORKED ON  --
			# -- IT CANNOT BE REACHED AS THE PANEL WITH THE BUTTONS IS NEVER DISPLAYED --
			
			if controlID == 80010:

				self.selected_skin = 'OSMC'

			else:

				self.selected_skin = 'Confluence'

			# display the sign-up panel
			self.getControl(98000).setVisible(False)
			self.getControl(99000).setVisible(True)
			self.getControl(1009).setVisible(True)
			self.setFocusId(90010)

		elif controlID in [90010, 90020]:	# newsletter sign up

			if controlID == 90010:

				# show keyboard
				kb = xbmc.Keyboard(self.email, 'Please enter your email')
				kb.doModal()
				if kb.isConfirmed():
					self.email = kb.getText()
					requests.post('https://osmc.tv/wp-content/plugins/newsletter/do/subscribe.php', data={'ne': self.email})

			# display the sign-up panel
			self.getControl(99000).setVisible(False)
			self.getControl(95000).setVisible(True)
			self.getControl(1005).setVisible(True)
			self.setFocusId(1005)

			# allow the user to exit
			self.prevent_escape = False