gtk2clockapp 2.0.210804 → 2.1.210819

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215e7757ee46c4f44b9d374b4630725a4cce8bed01b9c9c74ee676d6112c581a
4
- data.tar.gz: 452fe2563c797cff70514a76dbba80f05773cd2b5626725741bafba0d4bb43b0
3
+ metadata.gz: d5f28a1d3e170ed1c15e28394cdee787a7fcd2cfcc8fab1971dd1ad588b9294d
4
+ data.tar.gz: 9ed1880d154a032a94eaba9a62f3dc809c75c39f6ec0dd45719f226d449076bd
5
5
  SHA512:
6
- metadata.gz: cb68b1dc7bded22827e7ea74299fe8739064c5c4432de23a28fbdf3e2bd6612cdc753eff04e24ff46528b5a87714d885641e43ae5d74fd972cca6b168fdac637
7
- data.tar.gz: e016f69bb136594794cd5ceed8f898f28aba2224430b9cf0aa8555316d8ad1fee58f8341fbcd2fa54e2e1aea73a7b892c30c6dad9663330415d0bf7ea31dbef5
6
+ metadata.gz: 8f3b5754f6c0544e3c7d27338ffcebde191927321328a8bc2cbf68819423cd37384f5963f362b9f28cbef44facc7f7cec7240af3b80486f1e76fe19c0354ebd3
7
+ data.tar.gz: 2f6f0634370ce5ad60a708f49f74d6de01639e85af9773fa80195a6ea3dd7959a42ac86444a0b359aaa7a201302b28f35333adcfca3b051d0a6f3b3ce2a138a8
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Gtk2ClockApp
2
2
 
3
- * [VERSION 2.0.210804](https://github.com/carlosjhr64/gtk2clockapp/releases)
3
+ * [VERSION 2.1.210819](https://github.com/carlosjhr64/gtk2clockapp/releases)
4
4
  * [github](https://github.com/carlosjhr64/gtk2clockapp)
5
5
  * [rubygems](https://rubygems.org/gems/gtk2clockapp)
6
6
 
@@ -43,6 +43,7 @@ Options:
43
43
  --font=NAME Courier
44
44
  --background=COLOR 000000
45
45
  --day=COLOR 00FF00
46
+ --dusk=COLOR FF0000
46
47
  --night=COLOR 3F0000
47
48
  Types:
48
49
  INT /^[1-9]\d{1,2}$/
data/bin/gtk2clockapp CHANGED
@@ -9,10 +9,11 @@ Options:
9
9
  -v --version
10
10
  --fullscreen
11
11
  --notdecorated
12
- --size=INT \t 250
12
+ --size=INT \t 186
13
13
  --font=NAME \t Courier
14
14
  --background=COLOR \t 000000
15
15
  --day=COLOR \t 00FF00
16
+ --dusk=COLOR \t FF0000
16
17
  --night=COLOR \t 3F0000
17
18
  Types:
18
19
  INT /^[1-9]\\d{1,2}$/
@@ -21,6 +22,20 @@ Types:
21
22
  HELP
22
23
  HelpParser.int?(:size)
23
24
  gui = Gtk2ClockApp.gui
25
+ Thread.new do
26
+ now = lambda {|key| Time.now.strftime(Gtk2ClockApp::CONFIG[key])}
27
+ gui.set_date now[:DateA]
28
+ gui.set_time now[:Time]
29
+ loop do
30
+ sleep(60 - Time.now.sec)
31
+ gui.set_date now[:DateB]
32
+ gui.set_time now[:Time]
33
+ 11.times do |i|
34
+ sleep 5
35
+ gui.set_date now[[:DateA, :DateB][i%2]]
36
+ end
37
+ end
38
+ end
24
39
  gui.set_weather '' # '⛅ 75F 92F/66F'
25
40
  gui.set_spot '' # '🗠 WUT: $500'
26
41
  gui.set_alert '' # '📢 Attention!'
@@ -28,17 +43,19 @@ Thread.new do
28
43
  while line = $stdin.gets
29
44
  line.chomp!
30
45
  case line
31
- when /^Weather: (.*)$/
32
- gui.set_weather $1
33
- when /^Spot: (.*)$/
34
- gui.set_spot $1
35
- when /^Mode: (.*)$/
36
- mode = $1
46
+ when /^Weather:(.*)$/
47
+ gui.set_weather $1.strip
48
+ when /^Spot:(.*)$/
49
+ gui.set_spot $1.strip
50
+ when /^Mode:(.*)$/
51
+ mode = $1.strip
37
52
  case mode.downcase
38
- when 'night'
39
- gui.night_mode
40
53
  when 'day'
41
54
  gui.day_mode
55
+ when 'dusk'
56
+ gui.dusk_mode
57
+ when 'night'
58
+ gui.night_mode
42
59
  else
43
60
  $stderr.puts 'Unrecognized mode: '+mode
44
61
  end
@@ -46,5 +63,6 @@ Thread.new do
46
63
  gui.set_alert line
47
64
  end
48
65
  end
66
+ exit
49
67
  end
50
68
  Gtk.main
data/lib/gtk2clockapp.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Gtk2ClockApp
2
- VERSION = '2.0.210804'
2
+ VERSION = '2.1.210819'
3
3
 
4
4
  def self.gui
5
5
  require 'gtk3'
@@ -2,7 +2,7 @@ module Gtk2ClockApp
2
2
  OPTIONS ||= nil
3
3
 
4
4
  g = 2 - (1 + Math.sqrt(5))/2
5
- big = OPTIONS&.size? || 250
5
+ big = OPTIONS&.size? || 186
6
6
  medium = (big*g).round
7
7
  small = (big*g*g).round
8
8
  pad = (big*g*g*g).round
@@ -17,6 +17,7 @@ module Gtk2ClockApp
17
17
  color = {
18
18
  Background: '#'+(OPTIONS&.background || '000000'),
19
19
  Day: '#'+(OPTIONS&.day || '00FF00'),
20
+ Dusk: '#'+(OPTIONS&.dusk || 'FF0000'),
20
21
  Night: '#'+(OPTIONS&.night || '3F0000'),
21
22
  }
22
23
 
@@ -27,6 +28,7 @@ module Gtk2ClockApp
27
28
 
28
29
  Background: color[:Background],
29
30
  Day: color[:Day],
31
+ Dusk: color[:Dusk],
30
32
  Night: color[:Night],
31
33
 
32
34
  # Window
@@ -1,24 +1,9 @@
1
1
  module Gtk2ClockApp
2
2
  class Gui
3
- def now(key)
4
- Time.now.strftime(CONFIG[key])
5
- end
6
-
7
3
  def new_label(key)
8
4
  hbox = Such::Box.new @vbox, :hbox!
9
5
  Such::Label.new hbox, key
10
6
  end
11
-
12
- def time_label(key, seconds, *formats)
13
- label = new_label(key)
14
- i = 0
15
- label.set_text now(formats[i])
16
- GLib::Timeout.add(seconds*1000) do
17
- i = (i+1)%formats.length
18
- label.set_text now(formats[i])
19
- end
20
- label
21
- end
22
7
 
23
8
  def initialize
24
9
  @window = Such::Window.new :window! do Gtk.main_quit end
@@ -26,9 +11,8 @@ module Gtk2ClockApp
26
11
  @window.fullscreen if OPTIONS.fullscreen?
27
12
  @vbox = Such::Box.new @window, :vbox!
28
13
 
29
- @date = time_label(:medium_label!, 5, :DateA, :DateB)
30
- @time = time_label(:big_label!, 60, :Time)
31
-
14
+ @date = new_label(:medium_label!)
15
+ @time = new_label(:big_label!)
32
16
  @weather = new_label(:medium_label!)
33
17
  @spot = new_label(:medium_label!)
34
18
  @alert = new_label(:small_label!)
@@ -36,6 +20,14 @@ module Gtk2ClockApp
36
20
  @window.show_all
37
21
  end
38
22
 
23
+ def set_date(text)
24
+ @date.set_text text
25
+ end
26
+
27
+ def set_time(text)
28
+ @time.set_text text
29
+ end
30
+
39
31
  def set_weather(text)
40
32
  @weather.set_text text
41
33
  end
@@ -58,6 +50,12 @@ module Gtk2ClockApp
58
50
  end
59
51
  end
60
52
 
53
+ def dusk_mode
54
+ labels.each do |label|
55
+ label.override_color(:normal, CONFIG[:Dusk])
56
+ end
57
+ end
58
+
61
59
  def night_mode
62
60
  labels.each do |label|
63
61
  label.override_color(:normal, CONFIG[:Night])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gtk2clockapp
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.210804
4
+ version: 2.1.210819
5
5
  platform: ruby
6
6
  authors:
7
7
  - carlosjhr64
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-04 00:00:00.000000000 Z
11
+ date: 2021-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: help_parser