hetch 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +52 -37
- data/hetch.gemspec +4 -4
- data/lib/gui.rb +1 -1
- data/lib/hetch.rb +5 -0
- data/{hetch_tk.rb → lib/hetch_tk.rb} +2 -2
- metadata +7 -10
- data/test.txt +0 -17
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
NGUzZDlhZmE1YWYxN2MzZGNiMmU3YTAyMWM0YTllYTZkNjA4N2NkYw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
N2Q1MzIwZDRlYzFkNTViZjU3YzFiN2ZhZDBlNmM4OWRhZGU4M2NkMw==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZTVlNTBmN2VhZTliZTkwZjVlNzNkMTM4ZjgwMzNiOWVlYmI5MjczZmI3MDMw
|
10
|
+
NzNjMjg5NmYwMGJlYWU4YzZlOTIxZTEzZjE4M2Y1OTZkNGI3MTdmN2YyZTYx
|
11
|
+
ZGMzNzU5OTFhZGMyOTFkNjM5OGYxOWUyYWRhODYwNDBiYTMzYzk=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODI2OGRkYWNlYjYyNTA2ZGMwZWY4NzQ5NzU2NjIwYTc2YTJkZTk4ODgzZjZi
|
14
|
+
MDAyZjI2YzEyOWQ4YWNmMDM5MTVlYjA3ZWNmNzJkOTFjOTY5YzhlN2VhYTNk
|
15
|
+
ZWFiYjQzMTVkMjc2MzcyNmFhMDNiNmVhNmE4MzIwMWMwOTg5Mjc=
|
data/README.md
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
Description:
|
2
|
+
========
|
1
3
|
Hetch is Graphical User interface to fetch a Regex pattern from a text file and display the result in a text window in the same GUI.
|
2
4
|
|
3
5
|
The Gui is called by a simpified call to the Tcl/Tk Syntax built in a gui class in a separate "gui.rb"file.
|
@@ -5,51 +7,64 @@ The Gui is called by a simpified call to the Tcl/Tk Syntax built in a gui class
|
|
5
7
|
The "gui.rb"demonstrates the way to call various widgets including a Help menu on the Menubar which includes the instruction on use of "gui.rb". The Help text is included in a separate "guide.rb" file.
|
6
8
|
|
7
9
|
Classes:
|
8
|
-
|
9
|
-
class
|
10
|
-
class
|
10
|
+
======
|
11
|
+
* class Gui
|
12
|
+
* class H # Hetch file to fetch string matching a pattern
|
13
|
+
* class Guide # to "view" the help instructions
|
11
14
|
|
12
15
|
Files:
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
16
|
+
====
|
17
|
+
* gui.rb
|
18
|
+
* hetch.rb # contains a method to run the Gui from irb prompt
|
19
|
+
* guide.rb
|
20
|
+
* hetch_tk # file containing the main script to call GUI
|
17
21
|
|
18
22
|
USAGE:
|
19
|
-
|
23
|
+
=======
|
24
|
+
At the irb command prompt type:
|
25
|
+
>require 'hetch' ; H.run
|
26
|
+
|
27
|
+
Type the name of the text file in the first entry field and the Regex pattern in the second entry field. You can enter the full path of the file, e.g. c:\test without extension.
|
20
28
|
|
21
29
|
Using the 'gui.rb' file:
|
30
|
+
==============
|
22
31
|
the Gui class may be used for building other Gui's by calling the class name followed by the method with its parameters.
|
23
32
|
x, y are the row number (x) and column number (y) in grid geometry
|
24
33
|
|
25
|
-
1. Gui.root
|
26
|
-
2. Gui.entry($var1, x, y) : $var1 is the variable that contains entry text.
|
27
|
-
|
28
|
-
3. Gui.textfield(h, w, c1, c2, x, y) : The parameters are
|
34
|
+
1. **Gui.root**: no parameters
|
35
|
+
2. **Gui.entry**($var1, x, y) : $var1 is the variable that contains entry text.
|
36
|
+
**Gui.entry**($var2, x, y) : $var2 is the variable that contains entry
|
37
|
+
3. **Gui.textfield**(h, w, c1, c2, x, y) : The parameters are
|
29
38
|
h=height, w=width, c1=background color, c2=foreground color
|
30
|
-
4. Gui.button(tx1, m, x, y) : tx1= text on button, m= method triggered by button.
|
39
|
+
4. **Gui.button**(tx1, m, x, y) : tx1= text on button, m= method triggered by button.
|
40
|
+
5. **Gui.label**(tx2, x, y): tx2 = text on label
|
41
|
+
6. **Gui.show** :Tk.mainloop
|
42
|
+
|
43
|
+
Sample Method:
|
44
|
+
--------------
|
31
45
|
The method should be written in the active script before the end Gui.show command. e.g.
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
Gui.
|
45
|
-
Gui.
|
46
|
-
Gui.label("Enter Number",
|
47
|
-
Gui.entry($
|
48
|
-
Gui.
|
49
|
-
Gui.
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
46
|
+
This simple method just add the two variables and get result into the text window.
|
47
|
+
|
48
|
+
def m
|
49
|
+
z = $var1+ $var2
|
50
|
+
$textfield.delete(1.0, 'end')
|
51
|
+
$textfield.insert(1.0, '#{z}')
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
Sample Script:
|
56
|
+
------------------
|
57
|
+
require_relative 'gui'
|
58
|
+
Gui.root
|
59
|
+
Gui.menu
|
60
|
+
Gui.label("Enter Number", 0, 0)
|
61
|
+
Gui.entry($var1, 0, 1)
|
62
|
+
Gui.label("Enter Number", 1, 0)
|
63
|
+
Gui.entry($var2, 1, 1)
|
64
|
+
Gui.textfield(15, 1, "black", "white", 2, 1)
|
65
|
+
Gui.button("OK", "m" , 2, 0)
|
66
|
+
def m
|
67
|
+
$z = $var1 + $var2
|
68
|
+
$textfield.insert('end', "#$z")
|
69
|
+
end
|
70
|
+
Gui.show
|
data/hetch.gemspec
CHANGED
@@ -2,15 +2,15 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = "hetch"
|
5
|
-
s.version = "0.1.
|
5
|
+
s.version = "0.1.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
-
s.authors = ["Sabry
|
8
|
+
s.authors = ["Sabry Fattah"]
|
9
9
|
s.date = "2015-02-11"
|
10
|
-
s.description = "hetch is a GUI application to search a comma-separated text file and fetch data based on Regex search pattern. The Gui is based on simplified Tcl/Tk command statements"
|
10
|
+
s.description = "hetch is a GUI application to search a comma-separated text file and fetch data based on Regex search pattern. The Gui is based on simplified Tcl/Tk command statements. This version has a better documentation and improved performance"
|
11
11
|
s.email = "sabryabdelfattah@gmail.com"
|
12
12
|
s.extra_rdoc_files = ["README.md"]
|
13
|
-
s.files = ["hetch.gemspec", "
|
13
|
+
s.files = ["hetch.gemspec", "README.md", "lib/hetch_tk.rb", "lib/gui.rb", "lib/guide.rb", "lib/hetch.rb"]
|
14
14
|
s.homepage = "http://sabryfattah.com"
|
15
15
|
s.rdoc_options = ["--main", "README.md"]
|
16
16
|
s.require_paths = ["lib"]
|
data/lib/gui.rb
CHANGED
data/lib/hetch.rb
CHANGED
@@ -1,7 +1,12 @@
|
|
1
|
+
require 'gui'
|
1
2
|
#A class to search a text file and fetch a string matching a Regex pattern
|
2
3
|
# user provides the name of the file without extension and the Regex matching pattern
|
3
4
|
class H
|
4
5
|
|
6
|
+
def self.run
|
7
|
+
`ruby "C:/Ruby193/lib/ruby/gems/1.9.1/gems/hetch-0.1.0/lib/hetch_tk.rb"`
|
8
|
+
end
|
9
|
+
|
5
10
|
def self.fetch(file, match)
|
6
11
|
h = Hash[File.read("#{file}").split("\n").map{|i| i.split(', ')}]
|
7
12
|
m = h.keys
|
@@ -1,5 +1,5 @@
|
|
1
|
-
require '
|
2
|
-
require '
|
1
|
+
require 'gui.rb'
|
2
|
+
require 'hetch'
|
3
3
|
#_________________________________________________________________
|
4
4
|
#Main Script to build a GUI for "hetch.rb"
|
5
5
|
# user enter the name of the file without extension and Regex matching pattern to fetch
|
metadata
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hetch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
5
|
-
prerelease:
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
|
-
- Sabry
|
7
|
+
- Sabry Fattah
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
@@ -13,22 +12,22 @@ date: 2015-02-11 00:00:00.000000000 Z
|
|
13
12
|
dependencies: []
|
14
13
|
description: hetch is a GUI application to search a comma-separated text file and
|
15
14
|
fetch data based on Regex search pattern. The Gui is based on simplified Tcl/Tk
|
16
|
-
command statements
|
15
|
+
command statements. This version has a better documentation and improved performance
|
17
16
|
email: sabryabdelfattah@gmail.com
|
18
17
|
executables: []
|
19
18
|
extensions: []
|
20
19
|
extra_rdoc_files:
|
21
20
|
- README.md
|
22
21
|
files:
|
23
|
-
- hetch.gemspec
|
24
|
-
- hetch_tk.rb
|
25
22
|
- README.md
|
26
|
-
-
|
23
|
+
- hetch.gemspec
|
27
24
|
- lib/gui.rb
|
28
25
|
- lib/guide.rb
|
29
26
|
- lib/hetch.rb
|
27
|
+
- lib/hetch_tk.rb
|
30
28
|
homepage: http://sabryfattah.com
|
31
29
|
licenses: []
|
30
|
+
metadata: {}
|
32
31
|
post_install_message:
|
33
32
|
rdoc_options:
|
34
33
|
- --main
|
@@ -36,20 +35,18 @@ rdoc_options:
|
|
36
35
|
require_paths:
|
37
36
|
- lib
|
38
37
|
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
-
none: false
|
40
38
|
requirements:
|
41
39
|
- - ! '>='
|
42
40
|
- !ruby/object:Gem::Version
|
43
41
|
version: '0'
|
44
42
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
45
|
-
none: false
|
46
43
|
requirements:
|
47
44
|
- - ! '>='
|
48
45
|
- !ruby/object:Gem::Version
|
49
46
|
version: '0'
|
50
47
|
requirements: []
|
51
48
|
rubyforge_project:
|
52
|
-
rubygems_version:
|
49
|
+
rubygems_version: 2.4.5
|
53
50
|
signing_key:
|
54
51
|
specification_version: 3
|
55
52
|
summary: tk-based Gui App. to search for Regex match in text file
|
data/test.txt
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
James Benton,70116/504-621-8927/504-845 1427
|
2
|
-
Josephine Jeffrey, 48116/810-292-9388/810-374-9840
|
3
|
-
Art James, 8014/856-636-8749/856-264
|
4
|
-
Lenna Johnston, 907-385-4412/907-921-2010
|
5
|
-
Donette Foller, 513-570-1893/513-549-4561
|
6
|
-
Simona Morasca, 44805/419-503-2484/419-800-6759
|
7
|
-
Mitsue Tollner, 60632/773-573-6914/773-924-8565
|
8
|
-
Leota Dilliard, 408-752-3500/408-813-
|
9
|
-
Sage Wieser, 57105/605-414-2147/605-794-
|
10
|
-
Kris Marrier, 21224/410-655-8723/410-804-4694
|
11
|
-
Minna Amigon, 19443/215-874-1229/215-422-8694
|
12
|
-
Abel Maclead, 11953/631-335-3414/631-677-3675
|
13
|
-
Kiley Caldarera, 310-498-5651/310-254-3084
|
14
|
-
Graciela Ruta, 44023/440-780-8425/440-579-
|
15
|
-
Cammy Albares, 78045/956-537-6195/956-841-7216
|
16
|
-
Mattie Poquette, 85013/602-277-4385/602-953-6360
|
17
|
-
Meaghan Garufi, 37110/931-313-9635/931-235-7959
|