Stringscan

Check-in [ed3a0787fb]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Tweak UI layout
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:ed3a0787fbae6845dc1e8c0cab03206e4212aa01c62b92dc18858271a64c843b
User & Date: kevin 2017-09-17 23:05:58
Context
2017-09-18
02:17
More tweaks for version 1.1 check-in: 3d2ce95654 user: kevin tags: trunk
2017-09-17
23:05
Tweak UI layout check-in: ed3a0787fb user: kevin tags: trunk
2017-07-11
03:09
More tweaks for Windows build check-in: 123ba249da user: kevin tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to stringscan.rb.

53
54
55
56
57
58
59
60




61
62
63
64
65
66
67
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
...
260
261
262
263
264
265
266









267
268
269
270
271
272
273

274
275
276




277
278
279
280
281
282
283
...
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321

	if $platform == 'aqua'
		##map ruby proc to "odoc" Apple Event
		setDir = Tk.install_cmd(proc{
			|*args|
			filename=(args[0]).delete('{}')
			begin
				if File.directory?(filename)




					$dirname = filename
					$direntry.value = filename
				end
			rescue
				raise
			end
		})    
................................................................................
	choosedirproc = proc{choosedir}
	$choosebutton = Tk::Tile::Button.new($buttonframe) {
		image $folderimage
		takefocus 0
		padding 5
		command  choosedirproc
	}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	Tk::RbWidget::BalloonHelp.new($choosebutton, 'text'=>'Select Directory', 'background'=>'lightyellow', 'relief'=>'flat')
	stringgrepProc = proc {stringgrep}
	$runbutton = Tk::Tile::Button.new($buttonframe) {
		image $glassimage
		takefocus 0
		padding 5
		command stringgrepProc
	}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	Tk::RbWidget::BalloonHelp.new($runbutton, 'text'=>'Run Search', 'background'=>'lightyellow', 'relief'=>'flat')
	$sep = Tk::Tile::Separator.new($mainframe) { orient 'horizontal' }.pack('side'=> 'top', 'fill'=>'both')
	
	#labels and entries
	$topframe = Tk::Tile::Frame.new($mainframe){padding 5}.pack('side' => 'top','fill' => 'both','expand' => 'no')
	$chooselabel = Tk::Tile::Label.new($topframe) {text "Directory:"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	$direntry = Tk::Tile::Entry.new($topframe) {textvariable $dirname }.pack('side' => 'left','fill' => 'both','expand' => 'no')
	$termlabel = Tk::Tile::Label.new($topframe) {text "Search Term:"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
................................................................................
		bg 'white'
		state 'disabled'
	}.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
	$tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tscroll = Tk::Tile::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tbox.yscrollbar($tscroll)
	









	$root.bind("#{$accelkey}-Q", proc{exit})
	$root.bind("#{$accelkey}-q", proc{exit})
	$root.bind("#{$accelkey}-O", proc{choosedir})
	$root.bind("#{$accelkey}-o", proc{choosedir})
	$root.bind("#{$accelkey}-R", proc{stringgrep})
	$root.bind("#{$accelkey}-r", proc{stringgrep})
end


#select search directory
def choosedir




	$dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
	$direntry.value = $dirname
end

#read file for display in text widget
def highlighttext(file)
	$tbox.configure('state'=>'normal')
................................................................................
	$tbox.configure('state'=>'disabled')
end
#about window for app
def aboutWindow
	Tk::messageBox :type => 'ok',
	:message => 'Stringscan: Text Search Tool',
	:icon => 'info', :title => 'About Stringscan',
	:detail  => "Version 1.0\n(c) 2017 Wordtech Communications LLC",
	:parent => $root
end

#check version of installed software
def checkUpdate 
	Tk.tk_call('softwareupdate::setIcon', $icon)
	Tk.tk_call('softwareupdate::checkVersion', $appname, $appversion)







|
>
>
>
>







 







|







|







 







>
>
>
>
>
>
>
>
>







>



>
>
>
>







 







|







53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
...
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
...
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
...
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339

	if $platform == 'aqua'
		##map ruby proc to "odoc" Apple Event
		setDir = Tk.install_cmd(proc{
			|*args|
			filename=(args[0]).delete('{}')
			begin
			        if File.directory?(filename)
                                        $tbox.configure('state'=>'normal')
	                                $tbox.delete('1.0', 'end')
                                        $tbox.configure('state'=>'disabled')
                                        $lbox.delete(0, 'end')
					$dirname = filename
					$direntry.value = filename
				end
			rescue
				raise
			end
		})    
................................................................................
	choosedirproc = proc{choosedir}
	$choosebutton = Tk::Tile::Button.new($buttonframe) {
		image $folderimage
		takefocus 0
		padding 5
		command  choosedirproc
	}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	Tk::RbWidget::BalloonHelp.new($choosebutton, 'text'=>'Select Directory', 'background'=>'lightyellow', 'relief'=>'solid', 'borderwidth'=>1)
	stringgrepProc = proc {stringgrep}
	$runbutton = Tk::Tile::Button.new($buttonframe) {
		image $glassimage
		takefocus 0
		padding 5
		command stringgrepProc
	}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	Tk::RbWidget::BalloonHelp.new($runbutton, 'text'=>'Run Search', 'background'=>'lightyellow', 'relief'=>'solid', 'borderwidth'=>1)
	$sep = Tk::Tile::Separator.new($mainframe) { orient 'horizontal' }.pack('side'=> 'top', 'fill'=>'both')
	
	#labels and entries
	$topframe = Tk::Tile::Frame.new($mainframe){padding 5}.pack('side' => 'top','fill' => 'both','expand' => 'no')
	$chooselabel = Tk::Tile::Label.new($topframe) {text "Directory:"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	$direntry = Tk::Tile::Entry.new($topframe) {textvariable $dirname }.pack('side' => 'left','fill' => 'both','expand' => 'no')
	$termlabel = Tk::Tile::Label.new($topframe) {text "Search Term:"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
................................................................................
		bg 'white'
		state 'disabled'
	}.pack('side'=>'left','fill' => 'both', 'expand' => 'yes')
	$tscrollframe = Tk::Frame.new($bottomrightframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tscroll = Tk::Tile::Scrollbar.new($tscrollframe).pack('side'=>'right','fill' => 'y', 'expand' => 'no')
	$tbox.yscrollbar($tscroll)
	
	
	$labelframe = Tk::Tile::Frame.new($root).pack('side'=>'bottom', 'fill'=>'both', 'expand' => 'no')
	$bottomlabel = Tk::Tile::Label.new($labelframe) {text "No data displayed"}.pack('side' => 'left','fill' => 'both','expand' => 'no')
	$bottomsep = Tk::Tile::Separator.new($root) { orient 'horizontal' }.pack('side'=> 'bottom', 'fill'=>'both')
	
#p = Tk::Tile::Progressbar.new(parent) {orient 'horizontal'; length 200; mode 'determinate'}

#Searching for $searchterm in $dirname
	
	$root.bind("#{$accelkey}-Q", proc{exit})
	$root.bind("#{$accelkey}-q", proc{exit})
	$root.bind("#{$accelkey}-O", proc{choosedir})
	$root.bind("#{$accelkey}-o", proc{choosedir})
	$root.bind("#{$accelkey}-R", proc{stringgrep})
	$root.bind("#{$accelkey}-r", proc{stringgrep})
end


#select search directory
def choosedir
  	$tbox.configure('state'=>'normal')
	$tbox.delete('1.0', 'end')
        $tbox.configure('state'=>'disabled')
        $lbox.delete(0, 'end')
	$dirname = Tk::chooseDirectory('initialdir'=>Dir.home, 'parent'=>$root)
	$direntry.value = $dirname
end

#read file for display in text widget
def highlighttext(file)
	$tbox.configure('state'=>'normal')
................................................................................
	$tbox.configure('state'=>'disabled')
end
#about window for app
def aboutWindow
	Tk::messageBox :type => 'ok',
	:message => 'Stringscan: Text Search Tool',
	:icon => 'info', :title => 'About Stringscan',
	:detail  => "Version 1.1\n(c) 2017 WordTech Communications LLC",
	:parent => $root
end

#check version of installed software
def checkUpdate 
	Tk.tk_call('softwareupdate::setIcon', $icon)
	Tk.tk_call('softwareupdate::checkVersion', $appname, $appversion)