Stringscan

Check-in [8af3877f02]
Login

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

Overview
Comment:UI tweaks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 8af3877f0216289a6d1d83d7c6daa7a7800dd19b454d194b28856d94bb333514
User & Date: kevin 2017-09-20 02:47:34
Context
2017-09-20
02:51
UI tweaks check-in: db9c25e236 user: kevin tags: trunk
02:47
UI tweaks check-in: 8af3877f02 user: kevin tags: trunk
2017-09-19
11:43
Code formatting and cleanup check-in: 28f8803fe4 user: kevin tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to stringscan.rb.

77
78
79
80
81
82
83
84
85

86
87
88
89
90
91
92
77
78
79
80
81
82
83


84
85
86
87
88
89
90
91







-
-
+







    end  

    #core method; here we search for a string in text files within a directory and  display a list of matching files in the listbox 
    def stringgrep
        $root.update
        $file_list = []
        $grep_list = []
        $p.start
        $bottomlabel.configure('text' => "Searching for \"#{$searchterm}\" in #{$dirname}")
        $bottomlabel.configure('text' => "Searching for \"#{$searchterm}\" in #{$dirname}...")
        $lbox.delete(0, 'end')
        $tbox.configure('state'=>'normal')
        $tbox.delete('1.0', 'end')
        $tbox.configure('state'=>'disabled')
        $root.update
        Find.find("#{$dirname}") do |path|
            $file_list << path unless FileTest.directory?(path)
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
102
103
104
105
106
107
108

109
110
111
112
113
114
115







-







                    $lbox.insert('end', "#{i}")
                    f.close
                end
            end
        rescue
            #puts "Search term not found.\n"
        end
        $p.stop
        $grep_list = $lbox.get(0, 'end')
        num = $grep_list.count.to_s
        $bottomlabel.configure('text' => "Found #{num} matches for \"#{$searchterm}\" in #{$dirname}")
    end
rescue
    puts "Directory not found.\n"
    puts "Search complete.\n"
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
271
272
273
274
275
276
277

278
279
280
281
282
283
284







-







        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')
    $p = Tk::Tile::Progressbar.new($labelframe) {orient 'horizontal'; length 200; mode 'indeterminate'}.pack('side' => 'left','fill' => 'both','expand' => 'no')
    $bottomsep = Tk::Tile::Separator.new($root) { orient 'horizontal' }.pack('side'=> 'bottom', 'fill'=>'both')
    $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})