Skip to content

Commit

Permalink
Version 1.3.1
Browse files Browse the repository at this point in the history
### Changed
- Content of "about" tab was updated.
- Gold won from consecutive pomodoro changed from 2 to 1.5 gold.
- Improved animations.

### Fixed
- More specific trap to understand if Arduino is connected.
  • Loading branch information
damian-m-g committed Jan 9, 2022
1 parent ed93efe commit fa59fa5
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 76 deletions.
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.3.1] - 2022-01-09
### Changed
- Content of "about" tab was updated.
- Gold won from consecutive pomodoro changed from 2 to 1.5 gold.
- Improved animations.

### Fixed
- More specific trap to understand if Arduino is connected.

## [1.1.0] - 2020-02-26
### Added
- Bell sound at the end of a pomodoro & break.

## [1.0.0] - 2016-02-06
### Added
- Pristine version.
4 changes: 3 additions & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ source 'https://rubygems.org'

group :development do
gem 'rake'
gem 'rdoc'
gem 'bundler'
gem 'ocra'
end

group :production do
Expand All @@ -14,4 +14,6 @@ group :production do
gem 'fastimage'
gem 'win32-clipboard'
gem 'win32-mutex'
gem 'win32-sound'
gem 'mini_portile2'
end
10 changes: 8 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,19 @@ end
desc 'ocra --no-lzma(testing purpose)'
task :ocra_no_lzma, :version do |t, args|
args.with_defaults(:version => '')
system("ocra --chdir-first --no-lzma --icon './data/icon.ico' --output 'Pomodoro Tracker #{args[:version].!=('') ? "#{args[:version]}" : ''}.exe' './bin/pomodoro_tracker' './lib/**/*' './data/**/*.png' './ext/**/*'")
system("ocra --gemfile Gemfile --chdir-first --no-lzma --gem-full --icon './data/icon.ico' --output 'releases/Pomodoro Tracker #{args[:version].!=('') ? "#{args[:version]}" : ''}.exe' './bin/pomodoro_tracker' './lib/**/*' './data/**/*.wav' './data/**/*.png' './ext/**/*'")
end

desc 'ocra'
task :ocra, :version do |t, args|
args.with_defaults(:version => '')
system("ocra --chdir-first --windows --icon './data/icon.ico' --output 'Pomodoro Tracker #{args[:version].!=('') ? "#{args[:version]}" : ''}.exe' './bin/pomodoro_tracker' './lib/**/*' './data/**/*.png' './ext/**/*'")
system("ocra --gemfile Gemfile --chdir-first --windows --gem-full --icon './data/icon.ico' --output 'releases/Pomodoro Tracker #{args[:version].!=('') ? "#{args[:version]}" : ''}.exe' './bin/pomodoro_tracker' './lib/**/*' './data/**/*.wav' './data/**/*.png' './ext/**/*'")
end

desc 'ocra_with_window'
task :ocra_with_window, :version do |t, args|
args.with_defaults(:version => '')
system("ocra --gemfile Gemfile --chdir-first --gem-full --icon './data/icon.ico' --output 'releases/Pomodoro Tracker #{args[:version].!=('') ? "#{args[:version]}" : ''}.exe' './bin/pomodoro_tracker' './lib/**/*' './data/**/*.wav' './data/**/*.png' './ext/**/*'")
end

desc 'erase persisted data'
Expand Down
Binary file added data/bell.wav
Binary file not shown.
Binary file modified ext/AutoItX3.dll
Binary file not shown.
Binary file added ext/AutoItX3_x64.dll
Binary file not shown.
7 changes: 5 additions & 2 deletions ext/autoit-ffi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ module AutoIt
AU3_INTDEFAULT = -2147483647
# Used when constructing strings consumed by AutoIt
UTF_16LE_NULL = "\0".encode("UTF-16LE")

PLATFORM_X64 = RUBY_PLATFORM.match(/64/) ? true : false

extend FFI::Library
ffi_lib File.expand_path(File.dirname(__FILE__)) + "/AutoItX3.dll"
dll_path = File.expand_path(File.dirname(__FILE__))
dll_path << (PLATFORM_X64 ? "/AutoItX3_x64.dll" : "/AutoItX3.dll")
ffi_lib dll_path
ffi_convention :stdcall

FunctionAttacher.attach(self)
Expand Down
10 changes: 8 additions & 2 deletions ext/function_attacher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,15 @@ module FunctionAttacher
# See "doc/Function Prototypes (C).txt" for the C header file.
#
def self.attach(lib)
FUNCTION_PROTOTYPES.each { |fun| lib.attach_function *fun }
FUNCTION_PROTOTYPES.each do |fun|
begin
lib.attach_function *fun
# don't do this at home kids
rescue Exception
next
end
end
end

end
end

Expand Down
1 change: 1 addition & 0 deletions lib/pomodoro_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
require 'date'
require 'win32/clipboard'
require 'win32/mutex'
require 'win32/sound'

# source code
require_relative './pomodoro_tracker/v_fxgui'
Expand Down
2 changes: 1 addition & 1 deletion lib/pomodoro_tracker/m_arduino_interpreter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def arduino_present?(serial_port)
@sp = Serial.new(serial_port)
puts("#{serial_port} opened.")
true
rescue RubySerial::Exception
rescue RubySerial::Error
# there is nothing connected on *serial_port*
puts("#{serial_port} not opened.")
false
Expand Down
2 changes: 1 addition & 1 deletion lib/pomodoro_tracker/m_pomodoro_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def current_pomodoro_finished
@consecutive_pomodoros[:working_day] += 1
@consecutive_pomodoros[:global] += 1
# raise gold
@pomodoro_tracker.gamification.raise_gold(2)
@pomodoro_tracker.gamification.raise_gold(1.5)
else
# raise gold
@pomodoro_tracker.gamification.raise_gold(1)
Expand Down
7 changes: 3 additions & 4 deletions lib/pomodoro_tracker/m_pomodoro_tracker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ class PomodoroTracker
PROGRAM_DATA_PATH = "#{ENV['ProgramData'] || ENV['ALLUSERSPROFILE']}".gsub('\\', '/')
PROGRAM_DATA_PT_PATH = "#{PROGRAM_DATA_PATH}/Pomodoro Tracker"
PERSISTED_DATA_FILENAME = 'pd.pt'
VERSION = '1.0'
BUG_REPORTS_AND_FEATURES_REQUEST_URI = 'https://github.com/IgorJorobus/pomodoro_tracker/issues'
DONATIONS_URI = 'http://jorobuslab.net/main/en/pomodoro_tracker.html'
JOROBUSLAB_WEBSITE = 'http://jorobuslab.net'
VERSION = '1.3.1'
BUG_REPORTS_AND_FEATURES_REQUEST_URI = 'https://github.com/damian-m-g/pomodoro_tracker/issues'
JOROBUSLAB_WEBSITE = 'https://damian-m-g.github.io/'

# *dropbox_present* is #TrueClass or #FalseClass
# *arduino_connected* is #TrueClass or #FalseClass
Expand Down
126 changes: 63 additions & 63 deletions lib/pomodoro_tracker/v_fxgui.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Graphic User Interface.
class FXGUI

BELL_SOUND_PATH = "#{File.dirname(File.dirname(File.dirname(__FILE__ )))}/data/bell.wav"

# @param persisted_data [Array, NilClass]
# @param pomodoro_tracker [PomodoroTracker]
def initialize(persisted_data, pomodoro_tracker)
Expand Down Expand Up @@ -213,7 +215,7 @@ def start_counter
@main_window.update()
@main_window.repaint()
# put window on front
AutoItFFI::AutoIt.win_activate(@main_window.title)
AutoItFFI::AutoIt.win_activate(@main_window.title) if defined?(AutoItFFI)
@tabbook.setCurrent(0, true)
# update GUI
@main_window.create()
Expand All @@ -225,6 +227,8 @@ def start_counter
@main_window.update()
@main_window.repaint()
end
# play sound
Win32::Sound.play(BELL_SOUND_PATH)
# start animation
start_pomodoro_finished_animation()
# update GUI
Expand Down Expand Up @@ -255,7 +259,7 @@ def start_counter
@main_window.repaint()
# put window on front
@tabbook.setCurrent(0, true)
AutoItFFI::AutoIt.win_activate(@main_window.title)
AutoItFFI::AutoIt.win_activate(@main_window.title) if defined?(AutoItFFI)
@tabbook.setCurrent(0, true)
# update GUI
@main_window.create()
Expand All @@ -267,6 +271,8 @@ def start_counter
@main_window.update()
@main_window.repaint()
end
# play sound
Win32::Sound.play(BELL_SOUND_PATH)
# start animation
start_break_finished_animation()
# update labels on gbs
Expand Down Expand Up @@ -305,62 +311,62 @@ def transform_seconds_to_pretty_timeshow(seconds)
# Holds the entire system for a few seconds while an animation is performed on the seven segments.
def start_pomodoro_finished_animation
@app.beginWaitCursor()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = '25:00'
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = '25:00'
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
# break begins
@seven_segment.text = '00:00'
@main_window.update()
@main_window.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = '25:00'
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = '25:00'
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
# break begins
@seven_segment.text = '00:00'
@main_window.update()
@main_window.repaint()
@app.endWaitCursor()
end

def start_break_finished_animation
long_break = @pomodoro_system.current_break.long #: TrueClass or FalseClass
@app.beginWaitCursor()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = (long_break ? '15:00' : '05:00')
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = (long_break ? '15:00' : '05:00')
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
# break begins
@seven_segment.text = '00:00'
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = (long_break ? '15:00' : '05:00')
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = (long_break ? '15:00' : '05:00')
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
@seven_segment.text = ' : '
@seven_segment.update()
@seven_segment.repaint()
sleep(0.75)
# break begins
@seven_segment.text = '00:00'
@seven_segment.update()
@seven_segment.repaint()
@app.endWaitCursor()
end

Expand Down Expand Up @@ -546,7 +552,7 @@ def create_coins_label(parent)
# icon = FXPNGIcon.new(@app, File.read('./data/coin.png', {mode: 'rb'}), 0, IMAGE_ALPHAGUESS, 40, 42)
icon = FXPNGIcon.new(@app, File.read('./data/vault.png', {mode: 'rb'}), 0, IMAGE_ALPHAGUESS, 42, 42)
@label_coins_on_counter = FXLabel.new(parent, '', icon, opts: LABEL_NORMAL|LAYOUT_FILL)
@label_coins_on_counter.tipText = 'Accumulated coins'
@label_coins_on_counter.tipText = "Accumulated coins. You obtain 1 coin per pomodoro finished, 1.5 if it's consecutive (started within the minute of a break's end). You get -1 coin to interrupt a pomodoro."
fill_coins_amount_on_counter_tab()
FXPainter.paint_background(FXColor::VERDE, @label_coins_on_counter)
end
Expand Down Expand Up @@ -1249,26 +1255,20 @@ def draw_dinamyc_things_on_chart_graphic
=end

def create_tab_about(parent)
vertical0 = FXVerticalFrame.new(parent, opts: LAYOUT_CENTER_X|LAYOUT_CENTER_Y)
l0 = FXLabel.new(vertical0, "Version #{PomodoroTracker::VERSION}", opts: LABEL_NORMAL|LAYOUT_CENTER_X)
vertical0 = FXVerticalFrame.new(parent, opts: LAYOUT_CENTER_X|LAYOUT_CENTER_Y, padTop: 0)
l0 = FXLabel.new(vertical0, "Version #{PomodoroTracker::VERSION}", opts: LABEL_NORMAL|LAYOUT_CENTER_X, padTop: 0)
l0.font = big_font = FXFont.new(@app, 'Segoe UI,100,Bold,Straight')
horizontal0 = FXHorizontalFrame.new(vertical0, padding: 0, padTop: 10, opts: LAYOUT_CENTER_X, hSpacing: 0)
l1 = FXLabel.new(horizontal0, "\u{1 f 4 1e} Bug report && feature requests:", padRight: 0)
l1 = FXLabel.new(horizontal0, "Bug report && feature requests: ", padRight: 0)
l1.tipText = 'Label "bug" to point a bug, and "enhancement" to point a feature request'
l2 = FXLabel.new(horizontal0, PomodoroTracker::BUG_REPORTS_AND_FEATURES_REQUEST_URI, padLeft: 0)
l2.textColor = blue_link_color = FXRGB(34, 52, 83)
copy_s = 'Left click to copy on clipboard'
l2.tipText = copy_s
l2.connect(SEL_LEFTBUTTONPRESS) {|sender, selector, data| Win32::Clipboard.set_data(sender.text)}
horizontal1 = FXHorizontalFrame.new(vertical0, padding: 0, opts: LAYOUT_CENTER_X)
l3 = FXLabel.new(horizontal1, "\u2764 To donate:")
l4 = FXLabel.new(horizontal1, PomodoroTracker::DONATIONS_URI)
l4.textColor = blue_link_color
l4.tipText = copy_s
l4.connect(SEL_LEFTBUTTONPRESS) {|sender, selector, data| Win32::Clipboard.set_data(sender.text)}
horizontal2 = FXHorizontalFrame.new(vertical0, padding: 0, padTop: 10, opts: LAYOUT_CENTER_X, hSpacing: 0)
l5 = FXLabel.new(horizontal2, 'Developed by ', padRight: 0, opts: JUSTIFY_CENTER_Y|LAYOUT_CENTER_Y|LAYOUT_FILL_Y)
l6 = FXLabel.new(horizontal2, 'JorobusLab', padTop: 0)
l6 = FXLabel.new(horizontal2, 'DMG', padTop: 0)
l6.textColor = FXRGB(150, 0, 0)
l6.font = big_font
horizontal3 = FXHorizontalFrame.new(vertical0, padding: 0, opts: LAYOUT_CENTER_X)
Expand Down

0 comments on commit fa59fa5

Please sign in to comment.