jota 0.9.0dev5 → 0.9.0.dev7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/jota.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- # $Id: jota.rb 287 2010-11-21 17:31:39Z dz $
3
+ # $Id: jota.rb 296 2011-01-31 10:39:18Z dz $
4
4
 
5
5
 
6
6
  require 'getoptlong'
7
7
  require 'helper'
8
- require 'immediate'
8
+
9
9
  require 'version'
10
10
 
11
11
  class Jota
@@ -51,15 +51,17 @@ def usage
51
51
  puts("\t--update or -U \t\tchange clip from stdin ('regexp' required)")
52
52
  puts("\t--delete or -D \t\tdelete a clip ('regexp' required)")
53
53
  puts("\t--list or -L\t\tlist all clips ('regexp' ignored)")
54
+ puts("\t 'regexp' are Perl Regexps, may be like '#5' to select clip number 5")
54
55
  puts
55
56
  puts("GUI MODE")
56
- puts("\t--size 'WxH' or -s\tset window width and height to W and H")
57
+ puts("\t--size 'WxH' or -s\tset window width and height to W and H in pixels")
57
58
  puts
58
59
  puts("HELPING")
59
60
  puts("\t--help or -h\t\tthis help")
60
61
  puts("\t--version or -V\t\tshow version")
61
62
  puts("\t--verbose or -v\t\tset verbose mode, -vv is more verbose ")
62
63
  puts("\t--logfile or -f 'file'\twrite verbose output to 'file'")
64
+ puts
63
65
  end
64
66
 
65
67
  def error(msg)
@@ -197,7 +199,7 @@ def start_gui
197
199
  glade = Gui.new
198
200
  if @filename then
199
201
  open_or_fail(glade,@filename)
200
- if @regexp
202
+ if @regexp then
201
203
  goto_or_fail(glade,@regexp)
202
204
  end
203
205
  end
@@ -217,7 +219,7 @@ def start_gui
217
219
 
218
220
  begin
219
221
  Gtk.main
220
- rescue Interrupt
222
+ rescue Interrupt, SignalException
221
223
  glade.close
222
224
  rescue Exception => e
223
225
  print_verbose "crashing, #{e.class}: #{e.message}"
@@ -278,33 +280,36 @@ public
278
280
  def run
279
281
  parse_args
280
282
 
281
- begin
283
+ if @force == :immediate then
284
+ require 'immediate'
285
+ start_immediate
286
+ else
287
+ begin
282
288
  # this 'require' must be after the command line is parsed,
283
289
  # because 'require libglade2' parses the commandline too.
284
- require 'gui'
285
- gui_ok = true
286
- rescue Exception
287
- gui_ok = false
288
- end
290
+ require 'gui'
291
+ gui_ok = true
292
+ rescue Exception
293
+ gui_ok = false
294
+ end
289
295
 
290
- if @force == :immediate then
291
- start_immediate
292
- elsif @force == :gui and not gui_ok then
293
- puts "GUI not available (leave out the option '-g' or '--gui')"
294
- elsif @force == :text or not gui_ok then
295
- begin
296
- require "jota_curses"
297
- rescue LoadError
298
- if :gui_ok then
299
- error("Cannot load 'Curses', try '--gui'")
300
- else
301
- error("Cannot load 'GTK+' nor 'Curses'")
302
- end
303
- end
304
- start_curses
305
- else
306
- start_gui
307
- end
296
+ if @force == :gui and not gui_ok then
297
+ puts "GUI not available (leave out the option '-g' or '--gui')"
298
+ elsif @force == :text or not gui_ok then
299
+ begin
300
+ require "jota_curses"
301
+ rescue LoadError
302
+ if :gui_ok then
303
+ error("Cannot load 'Curses', try '--gui'")
304
+ else
305
+ error("Cannot load 'GTK+' nor 'Curses'")
306
+ end
307
+ end
308
+ start_curses
309
+ else
310
+ start_gui
311
+ end
312
+ end
308
313
 
309
314
  if $VERBOSE then
310
315
  print_verbose "stopped at #{Time.now}"
data/lib/jota_curses.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: jota_curses.rb 287 2010-11-21 17:31:39Z dz $
2
+ # $Id: jota_curses.rb 296 2011-01-31 10:39:18Z dz $
3
3
 
4
4
  require "curses"
5
5
  require 'tempfile'
@@ -58,33 +58,6 @@ def initialize
58
58
  @editor_running = false
59
59
 
60
60
  default_focus
61
-
62
- Curses.init_screen
63
- Curses.cbreak
64
- Curses.noecho
65
- Curses.nonl
66
-
67
- set_terminal
68
- @top_win_height = @lines/2
69
- set_windows
70
-
71
-
72
- begin
73
- # set SIGgnal handler if terminal WINdow CHanged
74
- Signal.trap("SIGWINCH") do
75
- print_debug "terminal size changed"
76
- set_terminal
77
- # ruby 1.9 can't cope with curses initializing and closing in fast succession
78
- # and the "sleep" makes fast resizing smoother
79
- sleep 0.1
80
- if not @editor_running then
81
- set_windows
82
- end
83
- end
84
- rescue ArgumentError
85
- # for example with Windows
86
- print_verbose "Cannot set trap for 'SIGWINCH'"
87
- end
88
61
  end
89
62
 
90
63
  def finish
@@ -106,7 +79,6 @@ def open(filename)
106
79
  @data = new_data
107
80
  @data.current_index = 0
108
81
  @top_win_first = 0
109
- draw_bars
110
82
  return @data
111
83
  end
112
84
 
@@ -152,6 +124,32 @@ def delete
152
124
  end
153
125
 
154
126
  def run
127
+ Curses.init_screen
128
+ Curses.cbreak
129
+ Curses.noecho
130
+ Curses.nonl
131
+
132
+ set_terminal
133
+ @top_win_height = @lines/2
134
+ set_windows
135
+
136
+ begin
137
+ # set SIGgnal handler if terminal WINdow CHanged
138
+ Signal.trap("SIGWINCH") do
139
+ print_debug "terminal size changed"
140
+ set_terminal
141
+ # ruby 1.9 can't cope with curses initializing and closing in fast succession
142
+ # and the "sleep" makes fast resizing smoother
143
+ sleep 0.1
144
+ if not @editor_running then
145
+ set_windows
146
+ end
147
+ end
148
+ rescue ArgumentError
149
+ # for example with Windows
150
+ print_verbose "Cannot set trap for 'SIGWINCH'"
151
+ end
152
+
155
153
  draw_bars
156
154
  adjust_top_win_first
157
155
  adjust_bot_win_first
data/lib/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # $Id: version.rb 285 2010-11-21 09:26:46Z dz $
2
+ # $Id: version.rb 298 2011-02-23 14:44:55Z dz $
3
3
 
4
4
 
5
5
  class Version
@@ -29,13 +29,14 @@ MAJOR = 0
29
29
  MINOR = 9
30
30
  PATCH = 0
31
31
  STATE = "dev" # "dev", "beta", "rc", "" (for final)
32
- STATEVER = 5
32
+ STATEVER = 7
33
33
 
34
34
  STRING = "%d.%d.%d%s" % [MAJOR, MINOR,PATCH,Version.state]
35
+ GEM_STRING = "%d.%d.%d.%s" % [MAJOR, MINOR,PATCH,Version.state]
35
36
 
36
37
  PROGRAM_NAME = "Jota"
37
38
  PROGRAM_NAMELC = PROGRAM_NAME.downcase
38
- YEARS = "2008-2010"
39
+ YEARS = "2008-2011"
39
40
 
40
41
  AUTHOR = "Derik van Zuetphen"
41
42
  AUTHOR_EMAIL = "dz@426.ch"
metadata CHANGED
@@ -1,13 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jota
3
3
  version: !ruby/object:Gem::Version
4
- hash: 470221477
4
+ hash: 1641194486
5
5
  prerelease: true
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 0dev5
10
- version: 0.9.0dev5
9
+ - 0
10
+ - dev7
11
+ version: 0.9.0.dev7
11
12
  platform: ruby
12
13
  authors:
13
14
  - Derik van Zuetphen
@@ -15,11 +16,11 @@ autorequire:
15
16
  bindir: bin
16
17
  cert_chain: []
17
18
 
18
- date: 2010-11-22 08:22:25 +01:00
19
+ date: 2011-02-27 20:40:19 +01:00
19
20
  default_executable:
20
21
  dependencies: []
21
22
 
22
- description: ""
23
+ description: A jotter application
23
24
  email: dz@426.ch
24
25
  executables:
25
26
  - jota
@@ -71,12 +72,12 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
72
  requirements:
72
73
  - - ">"
73
74
  - !ruby/object:Gem::Version
74
- hash: 25
75
+ hash: 31
75
76
  segments:
76
- - 1
77
- - 3
78
- - 1
79
- version: 1.3.1
77
+ - 0
78
+ - 0
79
+ - 0
80
+ version: 0.0.0
80
81
  requirements: []
81
82
 
82
83
  rubyforge_project: jota