tkwrapper 1.7.1 → 1.7.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 90b29c12036c765281e148238dd8b97afc06091749eeb5c8a8595ce8a3ddd589
4
- data.tar.gz: 8c7b8f7f3b5c9b54a239d9d7d034b14d8cde4e700d848e98d2b77329da03aa8b
3
+ metadata.gz: 3ffefbd7d08458a1cfa097980b725729a14165d4b0a6a63319d2b651ed64369d
4
+ data.tar.gz: 87bd8af7b88ad3951a44829763fae77e5fb874a934d129b8b205c42f7c14af9b
5
5
  SHA512:
6
- metadata.gz: 402470958a23a858dbe40ab101e31b61fd7ccbf6c240dbaa83a9c6e6727c94ca1a5e81e9d73ab571fc3c85b0ba275fece636793eacb487a98a60ed85bffc1661
7
- data.tar.gz: 3f74e9a050ec620ea4d77bc0e518dff8fe4037e79c37d5ca111d85f33d52288dc663449ba760a963fa26fb5dd2bcafb6d6edd9ecc6b84ac0831f67e1456bdbf1
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 = lines.size)
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tkwrapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Benjamin Schnitzler