RUIC 0.4.6 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (44) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +3 -3
  3. data/HISTORY +63 -52
  4. data/README.md +220 -220
  5. data/bin/ruic +12 -11
  6. data/gui/TODO +2 -2
  7. data/gui/appattributesmodel.rb +51 -51
  8. data/gui/appelementsmodel.rb +126 -126
  9. data/gui/launch.rb +19 -19
  10. data/gui/makefile +14 -14
  11. data/gui/resources/style/dark.qss +459 -459
  12. data/gui/window.rb +90 -90
  13. data/gui/window.ui +753 -753
  14. data/lib/ruic.rb +182 -175
  15. data/lib/ruic/application.rb +2 -2
  16. data/lib/ruic/assets.rb +436 -421
  17. data/lib/ruic/attributes.rb +170 -165
  18. data/lib/ruic/behaviors.rb +1 -1
  19. data/lib/ruic/interfaces.rb +23 -1
  20. data/lib/ruic/presentation.rb +100 -34
  21. data/lib/ruic/ripl-after-result.rb +24 -24
  22. data/lib/ruic/statemachine.rb +1 -1
  23. data/lib/ruic/version.rb +3 -3
  24. data/ruic.gemspec +25 -25
  25. data/test/MetaData-simple.xml +28 -28
  26. data/test/MetaData.xml +435 -435
  27. data/test/customclasses.ruic +31 -21
  28. data/test/filtering.ruic +43 -43
  29. data/test/futureassets.ruic +8 -8
  30. data/test/nonmaster.ruic +0 -0
  31. data/test/paths.ruic +18 -18
  32. data/test/projects/CustomClasses/CustomClasses.uia +7 -7
  33. data/test/projects/CustomClasses/CustomClasses.uip +7 -1
  34. data/test/projects/CustomClasses/FutureAsset.uip +17 -17
  35. data/test/projects/CustomClasses/scripts/DataDrivenTime.lua +58 -0
  36. data/test/projects/CustomClasses/scripts/TimeDrivenAttribute.lua +49 -0
  37. data/test/projects/Paths/Paths.uia +4 -4
  38. data/test/projects/Paths/Paths.uip +98 -98
  39. data/test/projects/SimpleScene/SimpleScene.uia +4 -4
  40. data/test/projects/SimpleScene/SimpleScene.uip +35 -35
  41. data/test/properties.ruic +82 -82
  42. data/test/referencematerials.ruic +52 -52
  43. data/test/usage.ruic +20 -20
  44. metadata +32 -4
data/bin/ruic CHANGED
@@ -17,8 +17,8 @@ HELP = <<ENDHELP
17
17
  -v, --version Show the version number (#{RUIC::VERSION}).
18
18
  -i, --interactive Enter an interactive REPL after running the script (if any).
19
19
  -m, --metadata The path to use for MetaData.xml
20
- Default: #{RUIC::DEFAULTMETADATA}
21
20
  Will be overridden by any `metadata` call in your script.
21
+ Default: #{RUIC::DEFAULTMETADATA}
22
22
  -u, --uia A UIC application file (.uia) to load.
23
23
  ENDHELP
24
24
 
@@ -27,10 +27,10 @@ UNFLAGGED_ARGS = [ :script ]
27
27
  next_arg = UNFLAGGED_ARGS.first
28
28
  ARGV.each do |arg|
29
29
  case arg
30
- when '-h','--help' then ARGS[:help] = true
31
- when '-v','--version' then ARGS[:version] = true
32
- when '-i','--interactive' then ARGS[:interactive] = true
33
- when '-m','--metadata' then next_arg = :meta
30
+ when '-h','--help' then ARGS[:help] = true
31
+ when '-v','--version' then ARGS[:version] = true
32
+ when '-i','--interactive' then ARGS[:repl] = true
33
+ when '-m','--metadata' then next_arg = :metadata
34
34
  when '-u','--uia' then next_arg = :uia
35
35
  else
36
36
  if next_arg
@@ -41,20 +41,21 @@ ARGV.each do |arg|
41
41
  end
42
42
  end
43
43
 
44
- puts "RUIC v#{RUIC::VERSION}" if ARGS[:version]
44
+ if ARGS.delete(:version)
45
+ puts "RUIC v#{RUIC::VERSION}"
46
+ exit 0 if ARGS.empty?
47
+ end
45
48
 
46
49
  if ARGS[:help]
47
50
  puts USAGE, HELP
48
51
  exit 0
49
52
  end
50
53
 
51
- if ARGS[:meta]
52
- RUIC::DEFAULTMETADATA.replace File.expand_path(ARGS[:meta])
53
- end
54
-
55
54
  if ARGS[:script] && File.extname(ARGS[:script])==".uia"
56
55
  ARGS[:uia] = ARGS[:script]
57
56
  ARGS[:script] = nil
58
57
  end
59
58
 
60
- RUIC script:ARGS[:script], uia:ARGS[:uia], repl:ARGS[:interactive] || !ARGS[:script]
59
+ %w[uia script metadata].each{ |arg| ARGS[arg]=File.expand_path(ARGS[arg]) if ARGS[arg=arg.to_sym] }
60
+ ARGS[:repl] ||= !ARGS[:script]
61
+ RUIC(ARGS)
data/gui/TODO CHANGED
@@ -1,2 +1,2 @@
1
- * Preferences file for last opened file directory - yml?
2
- * Revert!
1
+ * Preferences file for last opened file directory - yml?
2
+ * Revert!
@@ -1,51 +1,51 @@
1
- module UIC; end
2
- class UIC::GUI::AppAttributesModel < Qt::AbstractItemModel
3
- INVALIDINDEX = Qt::ModelIndex.new
4
- NODATA = Qt::Variant.new
5
- def initialize(qtparent,el)
6
- super(qtparent)
7
- @indexes = {} # indexed by [row,col]
8
- @root = Qt::ModelIndex.new
9
- @el = el
10
- el.properties.values.sort_by{ |p| p.formal.downcase }.each.with_index do |prop,i|
11
- @indexes[[i,0]] = createIndex( i, 0, Qt::Variant.new(prop.formal) )
12
- @indexes[[i,1]] = createIndex( i, 1, Qt::Variant.new(el[prop.name,0].to_s) )
13
- end
14
- end
15
-
16
- def columnCount( *any )
17
- 2
18
- end
19
-
20
- def index( row, col, parent=INVALIDINDEX )
21
- @indexes[[row,col]]
22
- end
23
-
24
- def headerData(section, orientation, role=Qt::DisplayRole)
25
- if orientation==Qt::Horizontal && role==Qt::DisplayRole
26
- case section
27
- when 0; Qt::Variant.new(tr("Attribute"))
28
- when 1; Qt::Variant.new(tr("Value"))
29
- else ; NODATA
30
- end
31
- else
32
- NODATA
33
- end
34
- end
35
-
36
- def parent(child)
37
- child.valid? ? @root : @INVALIDINDEX
38
- end
39
-
40
- def rowCount( parent=INVALIDINDEX )
41
- @rowcount ||= @el.properties.length
42
- end
43
-
44
- def data(index, role)
45
- if index.valid? && role == Qt::DisplayRole
46
- index.internal_pointer
47
- else
48
- NODATA
49
- end
50
- end
51
- end
1
+ module UIC; end
2
+ class UIC::GUI::AppAttributesModel < Qt::AbstractItemModel
3
+ INVALIDINDEX = Qt::ModelIndex.new
4
+ NODATA = Qt::Variant.new
5
+ def initialize(qtparent,el)
6
+ super(qtparent)
7
+ @indexes = {} # indexed by [row,col]
8
+ @root = Qt::ModelIndex.new
9
+ @el = el
10
+ el.properties.values.sort_by{ |p| p.formal.downcase }.each.with_index do |prop,i|
11
+ @indexes[[i,0]] = createIndex( i, 0, Qt::Variant.new(prop.formal) )
12
+ @indexes[[i,1]] = createIndex( i, 1, Qt::Variant.new(el[prop.name,0].to_s) )
13
+ end
14
+ end
15
+
16
+ def columnCount( *any )
17
+ 2
18
+ end
19
+
20
+ def index( row, col, parent=INVALIDINDEX )
21
+ @indexes[[row,col]]
22
+ end
23
+
24
+ def headerData(section, orientation, role=Qt::DisplayRole)
25
+ if orientation==Qt::Horizontal && role==Qt::DisplayRole
26
+ case section
27
+ when 0; Qt::Variant.new(tr("Attribute"))
28
+ when 1; Qt::Variant.new(tr("Value"))
29
+ else ; NODATA
30
+ end
31
+ else
32
+ NODATA
33
+ end
34
+ end
35
+
36
+ def parent(child)
37
+ child.valid? ? @root : @INVALIDINDEX
38
+ end
39
+
40
+ def rowCount( parent=INVALIDINDEX )
41
+ @rowcount ||= @el.properties.length
42
+ end
43
+
44
+ def data(index, role)
45
+ if index.valid? && role == Qt::DisplayRole
46
+ index.internal_pointer
47
+ else
48
+ NODATA
49
+ end
50
+ end
51
+ end
@@ -1,126 +1,126 @@
1
- module UIC; end
2
- class UIC::GUI::AppElementsModel < Qt::AbstractItemModel
3
- INVALIDINDEX = Qt::ModelIndex.new
4
- NODATA = Qt::Variant.new
5
- def initialize(qtparent,app)
6
- super(qtparent)
7
- @root = El.new(app,0)
8
- end
9
-
10
- def columnCount( *any )
11
- 2
12
- end
13
-
14
- def index( row, col, parent=INVALIDINDEX )
15
- parentEl = parent.valid? ? parent.internal_pointer : @root
16
- if childEl=parentEl.child(row)
17
- createIndex(row,col,childEl)
18
- else
19
- INVALIDINDEX
20
- end
21
- end
22
-
23
- def headerData(section, orientation, role=Qt::DisplayRole)
24
- if orientation==Qt::Horizontal && role==Qt::DisplayRole
25
- case section
26
- when 0; Qt::Variant.new(tr("Name"))
27
- when 1; Qt::Variant.new(tr("Type"))
28
- else ; NODATA
29
- end
30
- else
31
- NODATA
32
- end
33
- end
34
-
35
- def parent(child)
36
- if child.valid?
37
- parentEl = child.internal_pointer.parent
38
- if parentEl.nil? || parentEl==@root
39
- INVALIDINDEX
40
- else
41
- createIndex(parentEl.row, 0, parentEl)
42
- end
43
- else
44
- INVALIDINDEX
45
- end
46
- end
47
-
48
- def rowCount( parent=INVALIDINDEX )
49
- parentEl = parent.valid? ? parent.internal_pointer : @root
50
- parentEl.child_count
51
- end
52
-
53
- def data(index, role)
54
- if index.valid?
55
- element = index.internal_pointer
56
- case role
57
- when Qt::DisplayRole
58
- case index.column
59
- when 0; Qt::Variant.new(element.displayName)
60
- when 1; Qt::Variant.new(element.displayType)
61
- else ; NODATA
62
- end
63
- when Qt::DecorationRole
64
- index.column==0 ? element.icon : NODATA
65
- else
66
- NODATA
67
- end
68
- else
69
- NODATA
70
- end
71
- end
72
- end
73
-
74
- class UIC::GUI::AppElementsModel::El
75
- @by_el = {}
76
- class << self
77
- def [](el,row)
78
- @by_el[el] ||= self.new(el,row)
79
- end
80
- end
81
-
82
- attr_reader :row
83
- attr_reader :el
84
- def initialize(el,row)
85
- @el = el
86
- @isapp = el.is_a?( UIC::Application )
87
- @row = row
88
- end
89
- def child_count
90
- (@isapp ? @el.presentations : @el.children).length
91
- end
92
-
93
- def child(offset)
94
- kids = @isapp ? @el.presentations : @el.children
95
- self.class[ @isapp ? kids[offset].scene : kids[offset], offset ] if kids[offset]
96
- end
97
-
98
- def parent
99
- unless @el.is_a?( UIC::Application )
100
- self.class[@el.parent || @el.presentation.app, @row]
101
- end
102
- end
103
-
104
- def icon
105
- @icon ||= UIC::GUI::IconVariant[@el.type]
106
- end
107
-
108
- def displayName
109
- @el.type=='Scene' ? @el.path : @el.name
110
- end
111
- def displayType
112
- @el.type
113
- end
114
- end
115
-
116
- module UIC::GUI::IconVariant
117
- @by_path = {}
118
- def self.[]( alias_or_path )
119
- @by_path[alias_or_path] ||= begin
120
- icon = Qt::Pixmap.new(alias_or_path)
121
- icon = Qt::Pixmap.new(":/#{alias_or_path}") if icon.isNull
122
- icon = Qt::Pixmap.new(":/Unknown") if icon.isNull
123
- Qt::Variant.fromValue(icon)
124
- end
125
- end
126
- end
1
+ module UIC; end
2
+ class UIC::GUI::AppElementsModel < Qt::AbstractItemModel
3
+ INVALIDINDEX = Qt::ModelIndex.new
4
+ NODATA = Qt::Variant.new
5
+ def initialize(qtparent,app)
6
+ super(qtparent)
7
+ @root = El.new(app,0)
8
+ end
9
+
10
+ def columnCount( *any )
11
+ 2
12
+ end
13
+
14
+ def index( row, col, parent=INVALIDINDEX )
15
+ parentEl = parent.valid? ? parent.internal_pointer : @root
16
+ if childEl=parentEl.child(row)
17
+ createIndex(row,col,childEl)
18
+ else
19
+ INVALIDINDEX
20
+ end
21
+ end
22
+
23
+ def headerData(section, orientation, role=Qt::DisplayRole)
24
+ if orientation==Qt::Horizontal && role==Qt::DisplayRole
25
+ case section
26
+ when 0; Qt::Variant.new(tr("Name"))
27
+ when 1; Qt::Variant.new(tr("Type"))
28
+ else ; NODATA
29
+ end
30
+ else
31
+ NODATA
32
+ end
33
+ end
34
+
35
+ def parent(child)
36
+ if child.valid?
37
+ parentEl = child.internal_pointer.parent
38
+ if parentEl.nil? || parentEl==@root
39
+ INVALIDINDEX
40
+ else
41
+ createIndex(parentEl.row, 0, parentEl)
42
+ end
43
+ else
44
+ INVALIDINDEX
45
+ end
46
+ end
47
+
48
+ def rowCount( parent=INVALIDINDEX )
49
+ parentEl = parent.valid? ? parent.internal_pointer : @root
50
+ parentEl.child_count
51
+ end
52
+
53
+ def data(index, role)
54
+ if index.valid?
55
+ element = index.internal_pointer
56
+ case role
57
+ when Qt::DisplayRole
58
+ case index.column
59
+ when 0; Qt::Variant.new(element.displayName)
60
+ when 1; Qt::Variant.new(element.displayType)
61
+ else ; NODATA
62
+ end
63
+ when Qt::DecorationRole
64
+ index.column==0 ? element.icon : NODATA
65
+ else
66
+ NODATA
67
+ end
68
+ else
69
+ NODATA
70
+ end
71
+ end
72
+ end
73
+
74
+ class UIC::GUI::AppElementsModel::El
75
+ @by_el = {}
76
+ class << self
77
+ def [](el,row)
78
+ @by_el[el] ||= self.new(el,row)
79
+ end
80
+ end
81
+
82
+ attr_reader :row
83
+ attr_reader :el
84
+ def initialize(el,row)
85
+ @el = el
86
+ @isapp = el.is_a?( UIC::Application )
87
+ @row = row
88
+ end
89
+ def child_count
90
+ (@isapp ? @el.presentations : @el.children).length
91
+ end
92
+
93
+ def child(offset)
94
+ kids = @isapp ? @el.presentations : @el.children
95
+ self.class[ @isapp ? kids[offset].scene : kids[offset], offset ] if kids[offset]
96
+ end
97
+
98
+ def parent
99
+ unless @el.is_a?( UIC::Application )
100
+ self.class[@el.parent || @el.presentation.app, @row]
101
+ end
102
+ end
103
+
104
+ def icon
105
+ @icon ||= UIC::GUI::IconVariant[@el.type]
106
+ end
107
+
108
+ def displayName
109
+ @el.type=='Scene' ? @el.path : @el.name
110
+ end
111
+ def displayType
112
+ @el.type
113
+ end
114
+ end
115
+
116
+ module UIC::GUI::IconVariant
117
+ @by_path = {}
118
+ def self.[]( alias_or_path )
119
+ @by_path[alias_or_path] ||= begin
120
+ icon = Qt::Pixmap.new(alias_or_path)
121
+ icon = Qt::Pixmap.new(":/#{alias_or_path}") if icon.isNull
122
+ icon = Qt::Pixmap.new(":/Unknown") if icon.isNull
123
+ Qt::Variant.fromValue(icon)
124
+ end
125
+ end
126
+ end
@@ -1,20 +1,20 @@
1
- #encoding: utf-8
2
- require 'Qt'
3
- require_relative 'window'
4
-
5
- class Qt::Application
6
- def self.translate(*a,&b)
7
- method_missing(:translate,*a,&b).force_encoding('utf-8')
8
- end
9
- end
10
-
11
- Qt::CoreApplication.organization_name = "PhrogzSoft"
12
- Qt::CoreApplication.organization_domain = "phrogz.net"
13
- Qt::CoreApplication.application_name = "RUIC"
14
- $prefs = Qt::Settings.new
15
-
16
- $app = Qt::Application.new(ARGV)
17
- gui = UIC::GUI.new
18
- gui.show
19
- gui.open
1
+ #encoding: utf-8
2
+ require 'Qt'
3
+ require_relative 'window'
4
+
5
+ class Qt::Application
6
+ def self.translate(*a,&b)
7
+ method_missing(:translate,*a,&b).force_encoding('utf-8')
8
+ end
9
+ end
10
+
11
+ Qt::CoreApplication.organization_name = "PhrogzSoft"
12
+ Qt::CoreApplication.organization_domain = "phrogz.net"
13
+ Qt::CoreApplication.application_name = "RUIC"
14
+ $prefs = Qt::Settings.new
15
+
16
+ $app = Qt::Application.new(ARGV)
17
+ gui = UIC::GUI.new
18
+ gui.show
19
+ gui.open
20
20
  $app.exec