cosmos 4.2.2 → 4.2.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -91,31 +91,31 @@ module Cosmos
91
91
  lon_value[2] = (lon_value[1] + lon_value[0]) / 2.0
92
92
  end
93
93
 
94
- #GL::TexCoord(lon_value, lat_value)
94
+ #glTexCoord(lon_value, lat_value)
95
95
  return [[lon_value[0], lat_value[0]], [lon_value[1], lat_value[1]], [lon_value[2], lat_value[2]]]
96
96
  end
97
97
 
98
98
  def draw_triangle(v1, v2, v3)
99
- GL.Enable(GL::TEXTURE_2D)
100
- GL.PolygonMode(GL::FRONT_AND_BACK, GL::FILL)
101
- GL::Begin(GL::TRIANGLES)
99
+ glEnable(OpenGL::GL_TEXTURE_2D)
100
+ glPolygonMode(OpenGL::GL_FRONT_AND_BACK, OpenGL::GL_FILL)
101
+ glBegin(OpenGL::GL_TRIANGLES)
102
102
  tc1, tc2, tc3 = gen_tex_coords(v1, v2, v3)
103
- GL::TexCoord(tc1[0], tc1[1])
104
- GL::Vertex(v1)
105
- GL::TexCoord(tc2[0], tc2[1])
106
- GL::Vertex(v2)
107
- GL::TexCoord(tc3[0], tc3[1])
108
- GL::Vertex(v3)
109
- GL::End()
110
- GL.Disable(GL::TEXTURE_2D);
103
+ glTexCoord2f(tc1[0], tc1[1])
104
+ glVertex3f(v1[0], v1[1], v1[2])
105
+ glTexCoord2f(tc2[0], tc2[1])
106
+ glVertex3f(v2[0], v2[1], v2[2])
107
+ glTexCoord2f(tc3[0], tc3[1])
108
+ glVertex3f(v3[0], v3[1], v3[2])
109
+ glEnd()
110
+ glDisable(OpenGL::GL_TEXTURE_2D);
111
111
 
112
112
  #Show Triangles
113
- #GL.PolygonMode(GL::FRONT_AND_BACK, GL::LINE)
114
- #GL::Begin(GL::TRIANGLES)
115
- # GL::Vertex(v1)
116
- # GL::Vertex(v2)
117
- # GL::Vertex(v3)
118
- #GL::End()
113
+ #glPolygonMode(OpenGL::GL_FRONT_AND_BACK, OpenGL::GL_LINE)
114
+ #glBegin(OpenGL::GL_TRIANGLES)
115
+ # glVertex(v1)
116
+ # glVertex(v2)
117
+ # glVertex(v3)
118
+ #glEnd()
119
119
  end
120
120
 
121
121
  def subdivide_triangle(v1, v2, v3, depth)
@@ -144,49 +144,51 @@ module Cosmos
144
144
  end
145
145
 
146
146
  def drawshape(viewer)
147
- GL.PushMatrix
148
- GL.ShadeModel(GL::FLAT);
149
- GL.Enable(GL::DEPTH_TEST);
147
+ glPushMatrix()
148
+ glShadeModel(OpenGL::GL_FLAT);
149
+ glEnable(OpenGL::GL_DEPTH_TEST);
150
150
  if @first == true
151
- GL.PixelStore(GL::UNPACK_ALIGNMENT, 1)
152
- texName = GL::GenTextures(1)
153
- GL::BindTexture(GL::TEXTURE_2D, texName[0])
154
- GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_S, GL::REPEAT);
155
- GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_WRAP_T, GL::REPEAT);
156
- GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MAG_FILTER, GL::NEAREST);
157
- GL.TexParameter(GL::TEXTURE_2D, GL::TEXTURE_MIN_FILTER, GL::NEAREST);
158
- GL::TexImage2D(GL::TEXTURE_2D, 0, GL::RGBA, @image.width, @image.height, 0, GL::RGBA, GL::UNSIGNED_BYTE, @image_data)
159
-
160
- GL::TexEnv(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, GL::DECAL)
161
-
162
- @drawing_list = GL.GenLists(1)
163
- GL.NewList(@drawing_list, GL::COMPILE)
164
- GL.Enable(GL::TEXTURE_2D);
165
- GL.TexEnvf(GL::TEXTURE_ENV, GL::TEXTURE_ENV_MODE, GL::DECAL);
166
- GL::BindTexture(GL::TEXTURE_2D, texName[0])
151
+ glPixelStorei(OpenGL::GL_UNPACK_ALIGNMENT, 1)
152
+ tex_name_buf = ' ' * 8 # Buffer to hold texture names
153
+ glGenTextures(1, tex_name_buf)
154
+ texName = tex_name_buf.unpack('L2')[0]
155
+ glBindTexture(OpenGL::GL_TEXTURE_2D, texName)
156
+ glTexParameteri(OpenGL::GL_TEXTURE_2D, OpenGL::GL_TEXTURE_WRAP_S, OpenGL::GL_REPEAT)
157
+ glTexParameteri(OpenGL::GL_TEXTURE_2D, OpenGL::GL_TEXTURE_WRAP_T, OpenGL::GL_REPEAT)
158
+ glTexParameteri(OpenGL::GL_TEXTURE_2D, OpenGL::GL_TEXTURE_MAG_FILTER, OpenGL::GL_NEAREST)
159
+ glTexParameteri(OpenGL::GL_TEXTURE_2D, OpenGL::GL_TEXTURE_MIN_FILTER, OpenGL::GL_NEAREST)
160
+ glTexImage2D(OpenGL::GL_TEXTURE_2D, 0, OpenGL::GL_RGBA, @image.width, @image.height, 0, OpenGL::GL_RGBA, OpenGL::GL_UNSIGNED_BYTE, @image_data)
161
+
162
+ glTexEnvi(OpenGL::GL_TEXTURE_ENV, OpenGL::GL_TEXTURE_ENV_MODE, OpenGL::GL_DECAL)
163
+
164
+ @drawing_list = glGenLists(1)
165
+ glNewList(@drawing_list, OpenGL::GL_COMPILE)
166
+ glEnable(OpenGL::GL_TEXTURE_2D)
167
+ glTexEnvf(OpenGL::GL_TEXTURE_ENV, OpenGL::GL_TEXTURE_ENV_MODE, OpenGL::GL_DECAL)
168
+ glBindTexture(OpenGL::GL_TEXTURE_2D, texName)
167
169
  8.times do |index|
168
170
  subdivide_triangle(@vdata[@tindices[index][0]], @vdata[@tindices[index][1]], @vdata[@tindices[index][2]], 4)
169
171
  end
170
- GL.Disable(GL::TEXTURE_2D);
171
- GL.EndList
172
+ glDisable(OpenGL::GL_TEXTURE_2D);
173
+ glEndList()
172
174
 
173
175
  @first = false
174
176
  end
175
177
 
176
- GL.CallList(@drawing_list)
178
+ glCallList(@drawing_list)
177
179
 
178
180
  #Draw Axises
179
- #GL::Begin(GL::LINES)
180
- # GL::Color3f(1.0, 0.0, 0.0)
181
- # GL::Vertex([-2.0, 0.0, 0.0])
182
- # GL::Vertex([ 2.0, 0.0, 0.0])
183
- # GL::Vertex([ 0.0, -2.0, 0.0])
184
- # GL::Vertex([ 0.0, 2.0, 0.0])
185
- # GL::Vertex([ 0.0, 0.0, -2.0])
186
- # GL::Vertex([ 0.0, 0.0, 2.0])
187
- #GL::End()
188
-
189
- GL.PopMatrix
181
+ #glBegin(OpenGL::GL_LINES)
182
+ # glColor3f(1.0, 0.0, 0.0)
183
+ # glVertex([-2.0, 0.0, 0.0])
184
+ # glVertex([ 2.0, 0.0, 0.0])
185
+ # glVertex([ 0.0, -2.0, 0.0])
186
+ # glVertex([ 0.0, 2.0, 0.0])
187
+ # glVertex([ 0.0, 0.0, -2.0])
188
+ # glVertex([ 0.0, 0.0, 2.0])
189
+ #glEnd()
190
+
191
+ glPopMatrix()
190
192
  end
191
193
 
192
194
  def export
@@ -261,6 +261,28 @@ module Cosmos
261
261
  end
262
262
  end
263
263
 
264
+ # Returns an array with a "TARGET_NAME PACKET_NAME" string for every command in the system (PACKET_NAME == command name)
265
+ def all_packet_strings(include_hidden = false, splash = nil)
266
+ strings = []
267
+ tnames = target_names()
268
+ total = tnames.length.to_f
269
+ tnames.each_with_index do |target_name, index|
270
+ if splash
271
+ splash.message = "Processing #{target_name} command"
272
+ splash.progress = index / total
273
+ end
274
+
275
+ ignored_items = System.targets[target_name].ignored_items
276
+
277
+ packets(target_name).each do |command_name, packet|
278
+ # We don't audit against hidden or disabled packets/commands
279
+ next if !include_hidden and (packet.hidden || packet.disabled)
280
+ strings << "#{target_name} #{command_name}"
281
+ end
282
+ end
283
+ strings
284
+ end
285
+
264
286
  def all
265
287
  @config.commands
266
288
  end
@@ -19,6 +19,7 @@ Cosmos.catch_fatal_exception do
19
19
  require 'cosmos/gui/dialogs/cmd_details_dialog'
20
20
  require 'cosmos/tools/cmd_sender/cmd_sender_text_edit'
21
21
  require 'cosmos/tools/cmd_sender/cmd_param_table_item_delegate'
22
+ require 'cosmos/gui/widgets/full_text_search_line_edit'
22
23
  end
23
24
 
24
25
  module Cosmos
@@ -109,6 +110,21 @@ module Cosmos
109
110
  update_commands()
110
111
  @cmd_select.setCurrentText(options.packet[1]) if options.packet
111
112
  update_cmd_params()
113
+
114
+ # Handle searching entries
115
+ @search_box.completion_list = System.commands.all_packet_strings(true, splash)
116
+ @search_box.callback = lambda do |cmd|
117
+ split_cmd = cmd.split(" ")
118
+ if split_cmd.length == 2
119
+ target_name = split_cmd[0].upcase
120
+ @target_select.setCurrentText(target_name)
121
+ update_commands()
122
+ command_name = split_cmd[1]
123
+ @cmd_select.setCurrentText(command_name)
124
+ update_cmd_params()
125
+ end
126
+ end
127
+
112
128
  end
113
129
 
114
130
  # Unconfigure CosmosConfig to interact with splash screen
@@ -220,6 +236,10 @@ module Cosmos
220
236
  # If this is not set then when we refresh the command parameters they'll all be squished
221
237
  top_layout.setSizeConstraint(Qt::Layout::SetMinimumSize)
222
238
 
239
+ # Mnemonic Search Box
240
+ @search_box = FullTextSearchLineEdit.new(self)
241
+ top_layout.addWidget(@search_box)
242
+
223
243
  # Set the target combobox selection
224
244
  @target_select = Qt::ComboBox.new
225
245
  @target_select.setMaxVisibleItems(6)
@@ -1140,14 +1140,18 @@ module Cosmos
1140
1140
  dialog_layout.addLayout(button_layout)
1141
1141
 
1142
1142
  dialog.setLayout(dialog_layout)
1143
+ my_parent = self.parent
1144
+ while my_parent.parent
1145
+ my_parent = my_parent.parent
1146
+ end
1143
1147
  if dialog.exec == Qt::Dialog::Accepted
1144
1148
  if targets.empty?
1145
1149
  clear_disconnected_targets()
1146
- self.parent.parent.parent.statusBar.showMessage("")
1150
+ my_parent.statusBar.showMessage("")
1147
1151
  self.setPalette(Qt::Palette.new(Cosmos::DEFAULT_PALETTE))
1148
1152
  else
1149
1153
  config_file = chooser.filename
1150
- self.parent.parent.parent.statusBar.showMessage("Targets disconnected: #{targets.join(" ")}")
1154
+ my_parent.statusBar.showMessage("Targets disconnected: #{targets.join(" ")}")
1151
1155
  self.setPalette(Qt::Palette.new(Cosmos::RED_PALETTE))
1152
1156
  Splash.execute(self) do |splash|
1153
1157
  ConfigParser.splash = splash
@@ -67,7 +67,7 @@ module Cosmos
67
67
  return if @time[-1] == t_sec
68
68
 
69
69
  data2 = data.to_f
70
- if data2.infinite? or data2.nan?
70
+ if !(data2.infinite? or data2.nan?)
71
71
  # create time array
72
72
  @time << t_sec
73
73
 
@@ -290,7 +290,7 @@ class RubyLexUtils
290
290
  else
291
291
  yield lexed, false, inside_begin, line_no
292
292
  end
293
- else
293
+ elsif !lexed.empty?
294
294
  num_left_brackets = lexed.count('{')
295
295
  num_right_brackets = lexed.count('}')
296
296
  if num_left_brackets != num_right_brackets
@@ -300,14 +300,9 @@ class RubyLexUtils
300
300
  yield lexed, true, inside_begin, line_no
301
301
  end
302
302
  end
303
-
304
303
  lex.exp_line_no = lex.line_no
305
-
306
304
  break
307
305
  end # loop do
308
-
309
306
  end # while lexed
310
-
311
307
  end # def each_lexed_segment
312
-
313
308
  end
@@ -1,12 +1,12 @@
1
1
  # encoding: ascii-8bit
2
2
 
3
- COSMOS_VERSION = '4.2.2'
3
+ COSMOS_VERSION = '4.2.3'
4
4
  module Cosmos
5
5
  module Version
6
6
  MAJOR = '4'
7
7
  MINOR = '2'
8
- PATCH = '2'
9
- BUILD = '6c929b5a65fd9dc0631cdab312e71f65630fceff'
8
+ PATCH = '3'
9
+ BUILD = '90c87a409582104777955b2fb791e79da5d04e28'
10
10
  end
11
- VERSION = '4.2.2'
11
+ VERSION = '4.2.3'
12
12
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cosmos
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.2.2
4
+ version: 4.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Melton
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-04-11 00:00:00.000000000 Z
12
+ date: 2018-04-17 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -32,9 +32,6 @@ dependencies:
32
32
  - - ">="
33
33
  - !ruby/object:Gem::Version
34
34
  version: '4'
35
- - - "<"
36
- - !ruby/object:Gem::Version
37
- version: '6'
38
35
  type: :runtime
39
36
  prerelease: false
40
37
  version_requirements: !ruby/object:Gem::Requirement
@@ -42,9 +39,6 @@ dependencies:
42
39
  - - ">="
43
40
  - !ruby/object:Gem::Version
44
41
  version: '4'
45
- - - "<"
46
- - !ruby/object:Gem::Version
47
- version: '6'
48
42
  - !ruby/object:Gem::Dependency
49
43
  name: rake
50
44
  requirement: !ruby/object:Gem::Requirement
@@ -178,19 +172,19 @@ dependencies:
178
172
  - !ruby/object:Gem::Version
179
173
  version: '1.6'
180
174
  - !ruby/object:Gem::Dependency
181
- name: opengl
175
+ name: opengl-bindings
182
176
  requirement: !ruby/object:Gem::Requirement
183
177
  requirements:
184
178
  - - "~>"
185
179
  - !ruby/object:Gem::Version
186
- version: '0.10'
180
+ version: '1.6'
187
181
  type: :runtime
188
182
  prerelease: false
189
183
  version_requirements: !ruby/object:Gem::Requirement
190
184
  requirements:
191
185
  - - "~>"
192
186
  - !ruby/object:Gem::Version
193
- version: '0.10'
187
+ version: '1.6'
194
188
  - !ruby/object:Gem::Dependency
195
189
  name: qtbindings
196
190
  requirement: !ruby/object:Gem::Requirement