troshka 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/troshka.rb +12 -2
  2. data/lib/troshka/qt_editor.rb +27 -0
  3. metadata +3 -3
@@ -1,5 +1,15 @@
1
- %w{Qt4 qscintilla bond stringio}.each {|lib| require "#{lib}"}
1
+ %w{Qt4 bond stringio}.each {|lib| require "#{lib}"}
2
2
 
3
- %w{app detail detail_anything detail_array_hash editor output shell}.each do |lib|
3
+ begin
4
+ require "qscintilla"
5
+ require_relative "./troshka/editor"
6
+ rescue LoadError
7
+ # If you don't have QScintilla, Troshka uses a QTextEdit based widget
8
+ require_relative "./troshka/qt_editor"
9
+ end
10
+
11
+ %w{app detail detail_anything detail_array_hash output shell}.each do |lib|
4
12
  require_relative "./troshka/#{lib}"
5
13
  end
14
+
15
+
@@ -0,0 +1,27 @@
1
+ module Troshka
2
+
3
+ class Editor < Qt::TextEdit
4
+ attr_accessor :app
5
+
6
+ def keyPressEvent(evt)
7
+ if evt.key==Qt::Key_Return && evt.modifiers==Qt::Control_Modifier
8
+ @app.run text
9
+ else
10
+ super evt
11
+ end
12
+ end
13
+
14
+ def text
15
+ toPlainText
16
+ end
17
+
18
+ def text=(str)
19
+ setPlainText(str)
20
+ end
21
+
22
+ def move_to_end
23
+ moveCursor Qt::TextCursor::End
24
+ end
25
+ end
26
+
27
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: troshka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-21 00:00:00.000000000 Z
12
+ date: 2012-04-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bond
@@ -41,6 +41,7 @@ files:
41
41
  - lib/troshka/editor.rb
42
42
  - lib/troshka/app.rb
43
43
  - lib/troshka/detail_array_hash.rb
44
+ - lib/troshka/qt_editor.rb
44
45
  - lib/troshka/shell.rb
45
46
  - lib/troshka.rb
46
47
  - bin/troshka
@@ -64,7 +65,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
65
  version: '0'
65
66
  requirements:
66
67
  - QtRuby
67
- - QScintilla
68
68
  rubyforge_project:
69
69
  rubygems_version: 1.8.23
70
70
  signing_key: