tkwrapper 1.7.1 → 1.7.2
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.
- checksums.yaml +4 -4
- data/lib/widgets/auto_resize_text.rb +10 -14
- data/lib/widgets/text.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3ffefbd7d08458a1cfa097980b725729a14165d4b0a6a63319d2b651ed64369d
|
4
|
+
data.tar.gz: 87bd8af7b88ad3951a44829763fae77e5fb874a934d129b8b205c42f7c14af9b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a80b659836c0627f762a40c6c275a398d0cd786153e5687ab57e6c4ba4116db8d8cb91f238bb3ca00e15624dfe14d73fa283ed9489d3dc7d546ff08254b8518
|
7
|
+
data.tar.gz: 22d9d0c242d08248fd569c70f4a068cbe8e1725218bfd876db691e8ec93df5968021560f15770b816c150863f4191edc3f63466ac0472cba2df357b2267af48b
|
@@ -28,9 +28,18 @@ class TkWrapper::Widgets::AutoResizeText < TkWrapper::Widgets::Frame
|
|
28
28
|
@text.bind('<Modified>', &method(:autoresize))
|
29
29
|
TkGrid.propagate(tk_widget, 0)
|
30
30
|
resize(lines: @min_number_lines, chars: @min_number_chars)
|
31
|
-
#@text.resize(lines: @min_number_lines, chars: @min_number_chars)
|
32
31
|
end
|
33
32
|
|
33
|
+
def resize(height: nil, width: nil, lines: nil, chars: nil)
|
34
|
+
width = width_needed_for_chars(chars) if chars
|
35
|
+
height = height_needed_for_lines(lines) if lines
|
36
|
+
|
37
|
+
opts.width = width if width
|
38
|
+
opts.height = height if height
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
34
43
|
# width of cursor + borders (textfield + frame) + padding (textfield + frame)
|
35
44
|
def additional_width_needed_for_textfield
|
36
45
|
@text.opts.insertwidth +
|
@@ -52,19 +61,6 @@ class TkWrapper::Widgets::AutoResizeText < TkWrapper::Widgets::Frame
|
|
52
61
|
@text.height_of_lines(num_lines) + additional_height_needed_for_textfield
|
53
62
|
end
|
54
63
|
|
55
|
-
def resize_width
|
56
|
-
opts.width = width_needed_for_textfield
|
57
|
-
@parent.tk_widget.update
|
58
|
-
end
|
59
|
-
|
60
|
-
def resize(height: nil, width: nil, lines: nil, chars: nil)
|
61
|
-
width = width_needed_for_chars(chars) if chars
|
62
|
-
height = height_needed_for_lines(lines) if lines
|
63
|
-
|
64
|
-
opts.width = width if width
|
65
|
-
opts.height = height if height
|
66
|
-
end
|
67
|
-
|
68
64
|
def width_needed_for_textfield
|
69
65
|
@text.longest_line_width + additional_width_needed_for_textfield
|
70
66
|
end
|
data/lib/widgets/text.rb
CHANGED
@@ -44,7 +44,7 @@ class TkWrapper::Widgets::Text < TkWrapper::Widgets::Base::Widget
|
|
44
44
|
@font.linespace + opts.spacing1 + opts.spacing3
|
45
45
|
end
|
46
46
|
|
47
|
-
def height_of_lines(num_lines =
|
47
|
+
def height_of_lines(num_lines = count_lines)
|
48
48
|
h = num_lines * line_height_including_padding
|
49
49
|
|
50
50
|
# spacing 3: additional space between lines
|