mirror of
				https://github.com/kepler155c/opus
				synced 2025-10-31 07:33:00 +00:00 
			
		
		
		
	overview cleanup + chooser better events
This commit is contained in:
		| @@ -3001,22 +3001,26 @@ function UI.Chooser:eventHandler(event) | |||||||
| 	if event.type == 'key' then | 	if event.type == 'key' then | ||||||
| 		if event.key == 'right' or event.key == 'space' then | 		if event.key == 'right' or event.key == 'space' then | ||||||
| 			local _,k = Util.find(self.choices, 'value', self.value) | 			local _,k = Util.find(self.choices, 'value', self.value) | ||||||
|  | 			local choice | ||||||
| 			if k and k < #self.choices then | 			if k and k < #self.choices then | ||||||
| 				self.value = self.choices[k+1].value | 				choice = self.choices[k+1] | ||||||
| 			else | 			else | ||||||
| 				self.value = self.choices[1].value | 				choice = self.choices[1] | ||||||
| 			end | 			end | ||||||
| 			self:emit({ type = 'choice_change', value = self.value }) | 			self.value = choice.value | ||||||
|  | 			self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) | ||||||
| 			self:draw() | 			self:draw() | ||||||
| 			return true | 			return true | ||||||
| 		elseif event.key == 'left' then | 		elseif event.key == 'left' then | ||||||
| 			local _,k = Util.find(self.choices, 'value', self.value) | 			local _,k = Util.find(self.choices, 'value', self.value) | ||||||
|  | 			local choice | ||||||
| 			if k and k > 1 then | 			if k and k > 1 then | ||||||
| 				self.value = self.choices[k-1].value | 				choice = self.choices[k-1] | ||||||
| 			else | 			else | ||||||
| 				self.value = self.choices[#self.choices].value | 				choice = self.choices[#self.choices] | ||||||
| 			end | 			end | ||||||
| 			self:emit({ type = 'choice_change', value = self.value }) | 			self.value = choice.value | ||||||
|  | 			self:emit({ type = 'choice_change', value = self.value, element = self, choice = choice }) | ||||||
| 			self:draw() | 			self:draw() | ||||||
| 			return true | 			return true | ||||||
| 		end | 		end | ||||||
|   | |||||||
| @@ -37,12 +37,12 @@ local extSupport = Util.getVersion() >= 1.76 | |||||||
|  |  | ||||||
| local function loadApplications() | local function loadApplications() | ||||||
| 	local requirements = { | 	local requirements = { | ||||||
| 		turtle = function() return turtle end, | 		turtle = not not turtle, | ||||||
| 		advancedTurtle = function() return turtle and term.isColor() end, | 		advancedTurtle = turtle and term.isColor(), | ||||||
| 		advanced = function() return term.isColor() end, | 		advanced = term.isColor(), | ||||||
| 		pocket = function() return pocket end, | 		pocket = not not pocket, | ||||||
| 		advancedPocket = function() return pocket and term.isColor() end, | 		advancedPocket = pocket and term.isColor(), | ||||||
| 		advancedComputer = function() return not turtle and not pocket and term.isColor() end, | 		advancedComputer = not turtle and not pocket and term.isColor(), | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	applications = Util.readTable('sys/etc/app.db') | 	applications = Util.readTable('sys/etc/app.db') | ||||||
| @@ -76,10 +76,7 @@ local function loadApplications() | |||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		if a.requires then | 		if a.requires then | ||||||
| 			local fn = requirements[a.requires] | 			return requirements[a.requires] | ||||||
| 			if fn and not fn() then |  | ||||||
| 				return false |  | ||||||
| 			end |  | ||||||
| 		end | 		end | ||||||
|  |  | ||||||
| 		return true -- Util.startsWith(a.run, 'http') or shell.resolveProgram(a.run) | 		return true -- Util.startsWith(a.run, 'http') or shell.resolveProgram(a.run) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 kepler155c@gmail.com
					kepler155c@gmail.com