Gtkdialog Calendar

For discussions about programming, and for programming questions and advice


Moderator: Forum moderators

Post Reply
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Gtkdialog Calendar

Post by recobayu »

The last and better version is on the last post.
From this first post to the next, describing my code from simple to complex.

Here is my simple calendar using gtkdialog:

Code: Select all

#!/bin/bash

buat_tombol(){
    echo '
        <button width-request="50" height-request="50" relief="2">
            <label>'$1'</label>
            <action>echo '$1' `date "+%B %Y"`</action>
        </button>'
}

export -f buat_tombol

buat_perbaris(){

i=0
IFS=''
cal|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
#echo baris $i: "$line"

echo '
    <hbox spacing="0">'
for j in {1..7};do
    
    tgl=`echo "$line"|cut -d "," -f $j`
    if [ "$tgl" == "  " -o "$tgl" == " " -o "$tgl" == ""  ];then tgl=" -";fi
    buat_tombol "$tgl"
    
done
echo '
    </hbox>'
((i++))
done

}

export -f buat_perbaris


#h_screen=`xwininfo -root|sed '/Height/!d;s/.* //'`
#<window height-request="'$h_screen'" width-request="360">

echo '
<window>
<vbox spacing="0">
    <button relief="2">
        <label>'"`date "+%B %Y"`"'</label>
    </button>
'"`buat_perbaris`"'

</vbox>
</window>
'>gui_kalendermuks
gtkdialog -f gui_kalendermuks
Attachments
Screenshot.png
Screenshot.png (13.39 KiB) Viewed 1082 times
Last edited by recobayu on Tue Feb 22, 2022 7:16 pm, edited 1 time in total.
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Month

Code: Select all

#!/bin/sh

bln(){
	m=1
	
	for i in 1 2 3 4;do
		echo '		<hbox space-fill="true" space-expand="true">'
		for j in 1 2 3;do
		
		case $m in
			1) b="Jan";;
			2) b="Feb";;
			3) b="Mar";;
			4) b="Apr";;
			5) b="Mei";;
			6) b="Jun";;
			7) b="Jul";;
			8) b="Ags";;
			9) b="Sep";;
			10)b="Okt";;
			11)b="Nov";;
			12)b="Des";;
		esac
		
			echo '			<button width-request="50" height-request="50">
				<label>'$b'</label>
			</button>
			'
			((m++))
		done
		echo '		</hbox>'
	done
	
}

echo '
<window>

<notebook>
	<vbox>
		<button>
			<label>bulan ini</label>
		</button>
	</vbox>
	<vbox>
		'"`bln`"'
	</vbox>
	<input file>inputfile</input>
</notebook>
</window>' > guibln

gtkdialog -f guibln
User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Gtkdialog Calendar

Post by puppy_apprentice »

Something went wrong:

gtk-cal.png
gtk-cal.png (4 KiB) Viewed 1072 times
terminal-test.png
terminal-test.png (7.91 KiB) Viewed 1072 times

Please use English names for functions and comments.

Attachments
gui_kalendermuks.gz
erase .gz
(8.46 KiB) Downloaded 49 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Hi @puppy_apprentice
what version of your puppylinux?
I try on several puppy (imppup64, slacko64, voidpup64), bullseye-dog, and linux mint 20.3, and it can run.

Last edited by recobayu on Tue Feb 22, 2022 7:11 pm, edited 1 time in total.
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar using SVG button

Post by recobayu »

This calendar button using SVG file as input on it's number.

Code: Select all

#!/bin/bash

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>echo</action>
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
	
}

amonth(){
	m="$1"
	Y="$2"
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	B=`date -d 2022-"$m"-1 '+%B'`
	echo "$B $Y" > monthyear

	#echo "$m $Y"	#debug
	
	row=1
	cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			svg_number "$number_grid" 16 "number/grid_$row$column.svg"
		fi
		
		done
		((row++))
	done
}



svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}

export -f svg_number


mkdir -p number
#amonth 4
amonth


echo '
<window title="kalendermuks">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<label>'`cat monthyear`'</label>
			<action>refresh:btn_grid_11</action>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
		</button>
		
		<button relief="2" width-request="46" height-request="40">
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>
</window>' > guikalender

gtkdialog -f guikalender

We can use different month by change the value in line 65 (for example):

Code: Select all

amonth 4

to show April and

Code: Select all

amonth

to show this month

Attachments
amonth 4 --&gt; April
amonth 4 --> April
Screenshot.png (18.53 KiB) Viewed 1032 times
amonth --&gt; this month
amonth --> this month
Screenshot2.png (18.18 KiB) Viewed 1032 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

This script can refresh the button's "label" by click the arrow previous and next month.

Changelog:
1. Add arrow (previous and next) month
2. Grabfocus to current date
3. Using svg file as "label" of button grid

feel free to give advice.
Thank you

Code: Select all

#!/bin/bash

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>echo</action>
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	svg_word "$BY" 20 number/monthyear.svg

	#echo "$m $Y"	#debug
	
	row=1
	cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			svg_number "$number_grid" 16 "number/grid_$row$column.svg"
		fi
		
		today=`date "+%_d"`
		if [ "$number_grid" == "$today" ];then echo "btn_grid_$row$column" > btn_today;fi
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number


refresh_btn_grid(){
	for i in {1..7};do
		for j in {1..7};do
			echo '
			<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}



# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



mkdir -p number
#amonth 4
amonth







echo '
<window title="kalendermuks">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>refresh:btn_grid_11</action>
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>
<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>

</window>' > guikalender

gtkdialog -f guikalender
Attachments
Screenshot3.png
Screenshot3.png (18.24 KiB) Viewed 1021 times
User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Gtkdialog Calendar

Post by puppy_apprentice »

recobayu wrote: Tue Feb 22, 2022 2:57 pm

what version of your puppylinux?

slacko64 6.3.2

recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

puppy_apprentice wrote: Tue Feb 22, 2022 8:47 pm
recobayu wrote: Tue Feb 22, 2022 2:57 pm

what version of your puppylinux?

slacko64 6.3.2

Hi @puppy_apprentice, I try this code in slacko64 6.3.2. and I also got the same error. So, the solution is, replace the line

Code: Select all

cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'

with this:

Code: Select all

cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'

Just remove the `tr'. And it will run. You can try the code from my last post.

User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Gtkdialog Calendar

Post by puppy_apprentice »

Now works. You are on the good way to replace OSMO ;)

You can use variables instead of extra files, eg:

Code: Select all

line 30:
year_month=$(echo "$Y-$m-1")
line 56:
current_month=$year_month

Code: Select all

line 47:
if [ "$number_grid" == "$today" ];then btn_today=$(echo "btn_grid_$row$column") ;fi

Code: Select all

from line 120:
export cal_frontend='
<window title="kalendermuks">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>refresh:btn_grid_11</action>
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>
<action signal="focus-in-event">grabfocus:'$btn_today'</action>

</window>'

gtkdialog --program=cal_frontend

Edit: Tested more carefully and my changes don't work as expected.

Last edited by puppy_apprentice on Wed Feb 23, 2022 9:29 am, edited 1 time in total.
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Thank you @puppy_apprentice ..
Now, We can change the year directly by pressing the "Month Year" button.
I use notebook to "refresh" the gui. Here is the code:

Code: Select all

#!/bin/bash

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>echo</action>
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

btn2(){
	m=1
	for i in {1..3};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			b=`date -d "2022-$m-1" "+%b"`
			svg_number "$b" 14 number/grid2_$i$j.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid2_'$i$j'.svg</input>
				<action>echo '$m' > month</action>
				<action>year_to_month</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button</action>
'"`refresh_btn_grid`"'
				<variable>btn2_'$m'</variable>
			</button>'
			((m++))
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	echo "$Y" > year
	svg_word "$BY" 20 number/monthyear.svg
	svg_word "$Y" 20 number/year.svg

	#echo "$m $Y"	#debug
	
	row=1
	#cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
	cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			svg_number "$number_grid" 16 "number/grid_$row$column.svg"
		fi
		
		today=`date "+%_d"`
		if [ "$number_grid" == "$today" ];then echo "btn_grid_$row$column" > btn_today;fi
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month


change_year(){
	current_year=`cat year`
	new_year=$(( current_year $1 ))
	echo "$new_year" > year
	svg_word "$new_year" 20 number/year.svg
}
export -f change_year

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number


refresh_btn_grid(){
	for i in {1..7};do
		for j in {1..7};do
			echo '				<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}

month_to_year(){
	y=`cut -d "-" -f1 year_month`
	svg_word "$y" 20 number/year.svg
	echo "$y" > year
	echo 1 > tabpos
}
export -f month_to_year

year_to_month(){
	m=`cat month`
	y=`cat year`
	#BY=`date -d "$y-$m-1" "+%B %Y"`
	#svg_word "$BY" 20 number/monthyear.svg
	amonth "$m" "$y"
	echo 0 > tabpos
}
export -f year_to_month


# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



mkdir -p number
#amonth 4
amonth







echo '
<window title="kalendermuks">
<notebook show-tabs="false" shadow-type="0">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>month_to_year</action>
			<action>refresh:nb_kalender</action>
			<action>refresh:long_button2</action>
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/year.svg</input>
			<action>refresh:btn_grid_11</action>
			<variable>long_button2</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_year -1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_year +1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
	</hbox>
	'"`btn2`"'
</vbox>
<input file>tabpos</input>
<variable>nb_kalender</variable>
</notebook>
<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>

</window>' > guikalender

gtkdialog -f guikalender
Attachments
now, it is easily jumping in to several year after/ago
now, it is easily jumping in to several year after/ago
debdog-20220223161548.jpg (16.53 KiB) Viewed 960 times
month in year
month in year
debdog-20220223161512.jpg (9.87 KiB) Viewed 960 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Changelog:
Now, the selected month and "today" are colored.

Code: Select all

#!/bin/bash

color="#398EE7"
echo "$color" > selected_color

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>echo</action>
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

btn2(){
	m=1
	for i in {1..3};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			b=`date -d "2022-$m-1" "+%b"`
			svg_number "$b" 14 number/grid2_$m.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid2_'$m'.svg</input>
				<action>echo '$m' > month</action>
				<action>year_to_month</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button</action>
'"`refresh_btn_grid`"'
				<variable>btn2_'$m'</variable>
			</button>'
			((m++))
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	echo "$m"|sed 's/^0*//' > month
	echo "$Y" > year
	
	svg_word "$BY" 20 number/monthyear.svg
	svg_word "$Y" 20 number/year.svg

	#echo "$m $Y"	#debug
	
	row=1
	#cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
	cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		number_without_space=`echo "$number_grid"|sed 's/^ *//g'`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			if [ "$number_without_space" != "" ];then
			date_grid=`date -d "$Y"-"$m"-"$number_grid" "+%Y%m%d"`
			fi
			today=`date "+%Y%m%d"`
			if [ "$date_grid" == "$today" ];then 
				echo "btn_grid_$row$column" > btn_today
				svg_number_selected "$number_grid" 16 "number/grid_$row$column.svg"
			else
				svg_number "$number_grid" 16 "number/grid_$row$column.svg"
			fi
		fi
		
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month


change_year(){
	current_year=`cat year`
	new_year=$(( current_year $1 ))
	echo "$new_year" > year
	svg_word "$new_year" 20 number/year.svg
}
export -f change_year

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number

svg_number_selected(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="5" y="25" style="fill:'$color'; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-weight:bold; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number_selected


refresh_btn_grid(){
	for i in {1..7};do
		for j in {1..7};do
			echo '				<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}

refresh_btn2(){
	for i in {1..12};do
		echo '				<action>refresh:btn2_'$i'</action>'
	done	
}

month_to_year(){
	y=`cut -d "-" -f1 year_month`
	svg_word "$y" 20 number/year.svg
	
	m=`cat month`
	for i in {1..12};do
		b=`date -d "2022-$i-1" "+%b"`
		
		if [ "$i" == "$m" ];then
			svg_number_selected "$b" 14 number/grid2_$i.svg
		else
			svg_number "$b" 14 number/grid2_$i.svg
		fi
	done
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f month_to_year

year_to_month(){
	m=`cat month`
	y=`cat year`
	#BY=`date -d "$y-$m-1" "+%B %Y"`
	#svg_word "$BY" 20 number/monthyear.svg
	amonth "$m" "$y"
	echo 0 > tabpos
}
export -f year_to_month


# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



mkdir -p number
#amonth 4
amonth







echo '
<window title="kalendermuks">
<notebook show-tabs="false" shadow-type="0">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>month_to_year</action>
			<action>refresh:nb_kalender</action>
			<action>refresh:long_button2</action>
			'"`refresh_btn2`"'
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/year.svg</input>
			<action>refresh:btn_grid_11</action>
			<variable>long_button2</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_year -1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_year +1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
	</hbox>
	'"`btn2`"'
</vbox>
<input file>tabpos</input>
<variable>nb_kalender</variable>
</notebook>
<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>

</window>' > guikalender

gtkdialog -f guikalender
Attachments
debdog-20220223175356.jpg
debdog-20220223175356.jpg (9.56 KiB) Viewed 1208 times
debdog-20220223175340.jpg
debdog-20220223175340.jpg (15.88 KiB) Viewed 1208 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

I found the `date' command has limitation.

Code: Select all

# date --date='2038-1-20'
date: invalid date ‘2038-1-20’
# date --date='2038-1-19'
Tue Jan 19 12:00:00 AM WIB 2038
# 

The max date that still can be reach is on 19 Jan 2038.
But when I use minixcal, it can reach year 2309
Is there any replacement of date command in linux?

edit:
That is on voidpup32.
But when I try on linuxmint 20.3, the date command reach soo many year.

Code: Select all

muktyas@muktyas-Inspiron-N4050:~$ date -d "2147485547-12-31"
Rab 31 Des 2147485547 12:00:00  WIB
muktyas@muktyas-Inspiron-N4050:~$ date -d "2147485548-1-1"
date: invalid date ‘2147485548-1-1’
muktyas@muktyas-Inspiron-N4050:~$ 
jamesbond
Posts: 539
Joined: Tue Aug 11, 2020 3:02 pm
Location: The Pale Blue Dot
Has thanked: 75 times
Been thanked: 292 times

Re: Gtkdialog Calendar

Post by jamesbond »

recobayu wrote: Thu Feb 24, 2022 12:51 am

I found the `date' command has limitation.

Code: Select all

# date --date='2038-1-20'
date: invalid date ‘2038-1-20’
# date --date='2038-1-19'
Tue Jan 19 12:00:00 AM WIB 2038
# 

The max date that still can be reach is on 19 Jan 2038.

This is well-known. It is called as Year 2038 problem.
This is because "time" is 32-bit, and it will overflow on 20 Jan 2038.
Solution is to use 64-bit time. (64-bit time does not imply 64-bit operating system.)

But when I use minixcal, it can reach year 2309
Is there any replacement of date command in linux?

edit:
That is on voidpup32.

I'm quite surprised to hear this.
Modern distros should no longer have this problem by now.
See the Wikipedia article. People have been working on this for a very long time by now.

But when I try on linuxmint 20.3, the date command reach soo many year.

Is this 64-bit or 32-bit?
64-bit systems should not have any problems at all.
Old 32-bit systems may have problems, but recent ones shouldn't.

recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Thank you @jamesbond for 2038 problem information.
voidpup32 is still using that `date' command. But the problem does not appear in linux mint 20.3 because it is 64 bit OS.

changelog:
Now, we can change the year by two decades on the calendar.
Also, the selected date is colored orange, echo-ed on terminal, and written on click_date.

Still problem does not fix yet:
day or empty button (not number) still can has orange dot, and give the error message on terminal.

Here is the code:

Code: Select all

#!/bin/bash

color="#398EE7"
echo "$color" > selected_color

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>svg_number_click number/grid_'$i$j'.svg</action>
				<action>refresh:btn_grid_'$i$j'</action>
				'"`refresh_btn_grid`"'
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

btn2(){
	m=1
	for i in {1..3};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			b=`date -d "2022-$m-1" "+%b"`
			svg_number "$b" 14 number/grid2_$m.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid2_'$m'.svg</input>
				<action>echo '$m' > month</action>
				<action>year_to_month</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button</action>
'"`refresh_btn_grid`"'
				<variable>btn2_'$m'</variable>
			</button>'
			((m++))
		done
		echo '
		</hbox>'
	done
}

btn3(){
	touch top_left_year
	tly=`cat top_left_year`
	if [ "$tly" == "" ];then
		Y=`date "+%Y"`
		tly=$((Y-(Y%20)+1))		#top_left_year on grid
	fi
	
	Y="$tly"
	
	for i in {1..5};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			
			svg_number "$Y" 12 number/grid3_$i$j.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid3_'$i$j'.svg</input>
				<action>two_decades_to_year grid3_'$i$j'.svg</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button2</action>
				<variable>btn3_'$i$j'</variable>
			</button>'
			((Y++))
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	echo "$m"|sed 's/^0*//' > month
	echo "$Y" > year
	
	svg_word "$BY" 20 number/monthyear.svg
	svg_word "$Y" 20 number/year.svg

	#echo "$m $Y"	#debug
	
	row=1
	cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
	#cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		number_without_space=`echo "$number_grid"|sed 's/^ *//g'`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			if [ "$number_without_space" != "" ];then
			date_grid=`date -d "$Y"-"$m"-"$number_grid" "+%Y%m%d"`
			fi
			today=`date "+%Y%m%d"`
			if [ "$date_grid" == "$today" ];then 
				echo "btn_grid_$row$column" > btn_today
				svg_number_selected "$number_grid" 16 "number/grid_$row$column.svg"
			else
				svg_number "$number_grid" 16 "number/grid_$row$column.svg"
			fi
		fi
		
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month


change_year(){
	current_year=`cat year`
	new_year=$(( current_year $1 ))
	echo "$new_year" > year
	svg_word "$new_year" 20 number/year.svg
}
export -f change_year

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number

svg_number_selected(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="5" y="25" style="fill:'$color'; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-weight:bold; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number_selected

svg_number_click(){
	for i in {1..7};do
		for j in {1..7};do
			sed -i '/circle/d' number/grid_$i$j.svg
		done
	done	
	sed -i '2 a <circle cx="15" cy="2" r="2" style="fill:#FFA500" />' "$1"
	d=`grep -o ">.*</text>" "$1" |sed 's/>//g'|cut -d\< -f1`
	m=`cat month`
	y=`cat year`
	click_date=`date -d "$y-$m-$d" "+%A, %d %B %Y"`
	echo "$click_date"
	echo "$click_date" > click_date
}
export -f svg_number_click


refresh_btn_grid(){
	for i in {1..7};do
		for j in {1..7};do
			echo '				<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}

refresh_btn2(){
	for i in {1..12};do
		echo '				<action>refresh:btn2_'$i'</action>'
	done	
}

refresh_btn3(){
	for i in {1..5};do
		for j in {1..4};do
			echo '				<action>refresh:btn3_'$i$j'</action>'
		done
	done	
}

change_two_decades(){
	change="$1"
	Y=`cat year`
	
	if [ "$1" == "+1" ];then
		Y=$((Y+20))
	elif [ "$1" == "-1" ];then
		Y=$((Y-20))
	fi
	echo "$Y" > year
	
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	Y=$((Y-1))
	svg_word "$tly - $Y" 20 number/two_decades.svg	
}
export -f change_two_decades

month_to_year(){
	y=`cut -d "-" -f1 year_month`
	svg_word "$y" 20 number/year.svg
	
	m=`cat month`
	for i in {1..12};do
		b=`date -d "2022-$i-1" "+%b"`
		
		if [ "$i" == "$m" ];then
			svg_number_selected "$b" 14 number/grid2_$i.svg
		else
			svg_number "$b" 14 number/grid2_$i.svg
		fi
	done
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f month_to_year

year_to_month(){
	m=`cat month`
	y=`cat year`
	#BY=`date -d "$y-$m-1" "+%B %Y"`
	#svg_word "$BY" 20 number/monthyear.svg
	amonth "$m" "$y"
	echo 0 > tabpos
}
export -f year_to_month

year_to_two_decades(){
	Y=`cat year`
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	svg_word "$tly - $((Y-1))" 20 number/two_decades.svg
	
	
	echo 2 > tabpos
}
export -f year_to_two_decades

two_decades_to_year(){
	y=`grep -o ">.*</text>" number/"$1" |sed 's/>//g'|cut -d\< -f1`
	
	svg_word "$y" 20 number/year.svg
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f two_decades_to_year


# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



mkdir -p number
#amonth 4
amonth







echo '
<window title="kalendermuks">
<notebook show-tabs="false" shadow-type="0">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>month_to_year</action>
			<action>refresh:nb_kalender</action>
			<action>refresh:long_button2</action>
			'"`refresh_btn2`"'
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			<action>refresh:long_button</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/year.svg</input>
			<action>year_to_two_decades</action>
			<action>refresh:nb_kalender</action>
			<action>refresh:long_button3</action>
			'"`refresh_btn3`"'
			<variable>long_button2</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_year -1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_year +1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
	</hbox>
	'"`btn2`"'
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/two_decades.svg</input>
			<action>refresh:btn_grid_11</action>
			<variable>long_button3</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_two_decades -1</action>
			<action>year_to_two_decades</action>
			<action>refresh:long_button3</action>
			'"`refresh_btn3`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_two_decades +1</action>
			<action>refresh:long_button3</action>
			'"`refresh_btn3`"'
		</button>
		
	</hbox>
	'"`btn3`"'
</vbox>
<input file>tabpos</input>
<variable>nb_kalender</variable>
</notebook>
<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>

</window>' > guikalender

gtkdialog -f guikalender
Attachments
orange dot on click date
orange dot on click date
fossadog-20220226015903.jpg (47.05 KiB) Viewed 1122 times
two decades
two decades
fossadog-20220226015938.jpg (14 KiB) Viewed 1122 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Changelog:
1. Add today button on the top
2. Long Button on two decade, sensitive="false"
3. echo "click_date" when we click number and echo "Not a date" for else on terminal output
4. Exit by press Esc key

Code: Select all

#!/bin/bash

color="#398EE7"
echo "$color" > selected_color
mkdir -p number

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>svg_number_click number/grid_'$i$j'.svg</action>
				<action>refresh:btn_grid_'$i$j'</action>
				'"`refresh_btn_grid`"'
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

btn2(){
	m=1
	for i in {1..3};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			b=`date -d "2022-$m-1" "+%b"`
			svg_number "$b" 14 number/grid2_$m.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid2_'$m'.svg</input>
				<action>echo '$m' > month</action>
				<action>year_to_month</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button</action>
'"`refresh_btn_grid`"'
				<variable>btn2_'$m'</variable>
			</button>'
			((m++))
		done
		echo '
		</hbox>'
	done
}

btn3(){
	touch top_left_year
	tly=`cat top_left_year`
	if [ "$tly" == "" ];then
		Y=`date "+%Y"`
		tly=$((Y-(Y%20)+1))		#top_left_year on grid
	fi
	
	Y="$tly"
	
	for i in {1..5};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			
			svg_number "$Y" 12 number/grid3_$i$j.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid3_'$i$j'.svg</input>
				<action>two_decades_to_year grid3_'$i$j'.svg</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button2</action>
				<variable>btn3_'$i$j'</variable>
			</button>'
			((Y++))
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	echo "$m"|sed 's/^0*//' > month
	echo "$Y" > year
	
	svg_word "$BY" 20 number/monthyear.svg
	svg_word "$Y" 20 number/year.svg

	#echo "$m $Y"	#debug
	
	row=1
	cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
	#cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		number_without_space=`echo "$number_grid"|sed 's/^ *//g'`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			if [ "$number_without_space" != "" ];then
			date_grid=`date -d "$Y"-"$m"-"$number_grid" "+%Y%m%d"`
			fi
			today=`date "+%Y%m%d"`
			if [ "$date_grid" == "$today" ];then 
				echo "btn_grid_$row$column" > btn_today
				svg_number_selected "$number_grid" 16 "number/grid_$row$column.svg"
			else
				svg_number "$number_grid" 16 "number/grid_$row$column.svg"
			fi
		fi
		
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month


change_year(){
	current_year=`cat year`
	new_year=$(( current_year $1 ))
	echo "$new_year" > year
	svg_word "$new_year" 20 number/year.svg
}
export -f change_year

svg_now(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	#clock=`date "+%R"`
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="300" height="20">
  <rect width="300" height="20" style="fill:none; stroke-width:0" />
  <text x="2" y="90%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="left">'$1'</text>
</svg>' > "$3"
}
export -f svg_now

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number

svg_number_selected(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="5" y="25" style="fill:'$color'; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-weight:bold; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number_selected

svg_number_click(){
	for i in {1..7};do
		for j in {1..7};do
			sed -i '/circle/d' number/grid_$i$j.svg
		done
	done	
	sed -i '2 a <circle cx="15" cy="2" r="2" style="fill:#FFA500" />' "$1"
	d=`grep -o ">.*</text>" "$1" |sed 's/>//g'|cut -d\< -f1|sed 's/^ *//g'`
	m=`cat month`
	y=`cat year`
	if [[ $d =~ [0-9] ]];then
	click_date=`date -d "$y-$m-$d" "+%A, %d %B %Y"`
	else
		click_date="Not a date"
	fi
	echo "$click_date"
	echo "$click_date" > click_date
}
export -f svg_number_click


refresh_btn_grid(){
	echo '				<action>refresh:long_button</action>'
	for i in {1..7};do
		for j in {1..7};do
			echo '				<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}

refresh_btn2(){
	echo '				<action>refresh:long_button2</action>'
	for i in {1..12};do
		echo '				<action>refresh:btn2_'$i'</action>'
	done	
}

refresh_btn3(){
	echo '				<action>refresh:long_button3</action>'
	for i in {1..5};do
		for j in {1..4};do
			echo '				<action>refresh:btn3_'$i$j'</action>'
		done
	done	
}

change_two_decades(){
	change="$1"
	Y=`cat year`
	
	if [ "$1" == "+1" ];then
		Y=$((Y+20))
	elif [ "$1" == "-1" ];then
		Y=$((Y-20))
	fi
	echo "$Y" > year
	
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	Y=$((Y-1))
	svg_word "$tly - $Y" 20 number/two_decades.svg	
}
export -f change_two_decades

month_to_year(){
	y=`cut -d "-" -f1 year_month`
	svg_word "$y" 20 number/year.svg
	
	m=`cat month`
	for i in {1..12};do
		b=`date -d "2022-$i-1" "+%b"`
		
		if [ "$i" == "$m" ];then
			svg_number_selected "$b" 14 number/grid2_$i.svg
		else
			svg_number "$b" 14 number/grid2_$i.svg
		fi
	done
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f month_to_year

year_to_month(){
	m=`cat month`
	y=`cat year`
	#BY=`date -d "$y-$m-1" "+%B %Y"`
	#svg_word "$BY" 20 number/monthyear.svg
	amonth "$m" "$y"
	echo 0 > tabpos
}
export -f year_to_month

year_to_two_decades(){
	Y=`cat year`
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	svg_word "$tly - $((Y-1))" 20 number/two_decades.svg
	
	
	echo 2 > tabpos
}
export -f year_to_two_decades

two_decades_to_year(){
	y=`grep -o ">.*</text>" number/"$1" |sed 's/>//g'|cut -d\< -f1`
	
	svg_word "$y" 20 number/year.svg
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f two_decades_to_year


now(){
	today=`date "+%A, %d %B %Y"`
	svg_now "$today" 11 number/today.svg
	amonth
	echo 0 > tabpos
	
	echo "$today"
	echo "$today" > click_date
}
export -f now


# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



#amonth 4
#amonth
now






echo '
<window title="kalendermuks">
<vbox spacing="0">

<button xalign="0" relief="2" padding="0">
	<input file>number/today.svg</input>
	<action>now</action>
	<action>refresh:nb_kalender</action>
	<action>grabfocus:'"`cat btn_today`"'</action>
	'"`refresh_btn_grid`"'
</button>


<notebook show-tabs="false" shadow-type="0">
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>month_to_year</action>
			<action>refresh:nb_kalender</action>
			'"`refresh_btn2`"'
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/year.svg</input>
			<action>year_to_two_decades</action>
			<action>refresh:nb_kalender</action>
			'"`refresh_btn3`"'
			<variable>long_button2</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_year -1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_year +1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
	</hbox>
	'"`btn2`"'
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0" sensitive="false">
			<input file>number/two_decades.svg</input>
			<variable>long_button3</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_two_decades -1</action>
			<action>year_to_two_decades</action>
			'"`refresh_btn3`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_two_decades +1</action>
			'"`refresh_btn3`"'
		</button>
		
	</hbox>
	'"`btn3`"'
</vbox>
<input file>tabpos</input>
<variable>nb_kalender</variable>
</notebook>

</vbox>

<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">exit:Esc</action>
</window>' > guikalender

gtkdialog -f guikalender
Attachments
fossadog-20220226235650.jpg
fossadog-20220226235650.jpg (30.58 KiB) Viewed 1086 times
recobayu
Posts: 64
Joined: Tue Jul 14, 2020 9:34 am
Has thanked: 11 times
Been thanked: 8 times

Re: Gtkdialog Calendar

Post by recobayu »

Bug:
Repeated date if the last number is on the first column.

Changelog:
Add hseparator and show-border="false" on notebook

Code: Select all

#!/bin/bash

color="#398EE7"
echo "$color" > selected_color
mkdir -p number

btn(){
	for i in {1..7};do
		echo '
		<hbox spacing="0">'
		for j in {1..7};do
			echo '
			<button relief="2" width-request="46" height-request="40">
				<input file>number/grid_'$i$j'.svg</input>
				<action>svg_number_click number/grid_'$i$j'.svg</action>
				<action>refresh:btn_grid_'$i$j'</action>
				'"`refresh_btn_grid`"'
				<variable>btn_grid_'$i$j'</variable>
			</button>'
		
		done
		echo '
		</hbox>'
	done
}

btn2(){
	m=1
	for i in {1..3};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			b=`date -d "2022-$m-1" "+%b"`
			svg_number "$b" 14 number/grid2_$m.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid2_'$m'.svg</input>
				<action>echo '$m' > month</action>
				<action>year_to_month</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button</action>
'"`refresh_btn_grid`"'
				<variable>btn2_'$m'</variable>
			</button>'
			((m++))
		done
		echo '
		</hbox>'
	done
}

btn3(){
	touch top_left_year
	tly=`cat top_left_year`
	if [ "$tly" == "" ];then
		Y=`date "+%Y"`
		tly=$((Y-(Y%20)+1))		#top_left_year on grid
	fi
	
	Y="$tly"
	
	for i in {1..5};do
		echo '
		<hbox spacing="0">'
		for j in {1..4};do
			
			svg_number "$Y" 12 number/grid3_$i$j.svg
			
			echo '
			<button relief="2" width-request="80" height-request="70">
				<input file>number/grid3_'$i$j'.svg</input>
				<action>two_decades_to_year grid3_'$i$j'.svg</action>
				<action>refresh:nb_kalender</action>
				<action>refresh:long_button2</action>
				<variable>btn3_'$i$j'</variable>
			</button>'
			((Y++))
		done
		echo '
		</hbox>'
	done
}

amonth(){
	m="$1"
	Y="$2"
	
	#echo "$m $Y"	#debug
	if [ "$m" == "" ];then m=`date +'%m'`;fi
	if [ "$Y" == "" ];then Y=`date +'%Y'`;fi
	
	BY=`date -d "$Y"-"$m"-1 '+%B %Y'`
	echo "$Y-$m-1" > year_month
	echo "$m"|sed 's/^0*//' > month
	echo "$Y" > year
	
	svg_word "$BY" 20 number/monthyear.svg
	svg_word "$Y" 20 number/year.svg

	#echo "$m $Y"	#debug
	
	row=1
	cal "$m" "$Y"|tr -cd '\11\12\15\40\60-\136\140-\176'|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
	#cal "$m" "$Y"|sed -e '1d;s/\(..\)\(.\)/\1,/g'|while read line;do
		for column in {1..7};do
		number_grid=`echo "$line"|cut -d "," -f $column`
		number_without_space=`echo "$number_grid"|sed 's/^ *//g'`
		
		if [ "$row" == "1" ];then
			svg_number "$number_grid" 10 "number/grid_$row$column.svg"
		else
			if [ "$number_without_space" != "" ];then
			date_grid=`date -d "$Y"-"$m"-"$number_grid" "+%Y%m%d"`
			fi
			today=`date "+%Y%m%d"`
			if [ "$date_grid" == "$today" ];then 
				echo "btn_grid_$row$column" > btn_today
				svg_number_selected "$number_grid" 16 "number/grid_$row$column.svg"
			else
				svg_number "$number_grid" 16 "number/grid_$row$column.svg"
			fi
		fi
		
		
		done
		((row++))
	done
}
export -f amonth

change_month(){
	current_month=`cat year_month`
	new_month=`date -d "$current_month $1 month" "+%Y-%m-1"`
	
	BY=`date -d "$new_month" "+%B %Y"`
	m=`date -d "$new_month" "+%m"`
	Y=`date -d "$new_month" "+%Y"`
	
	amonth "$m" "$Y"
}
export -f change_month


change_year(){
	current_year=`cat year`
	new_year=$(( current_year $1 ))
	echo "$new_year" > year
	svg_word "$new_year" 20 number/year.svg
}
export -f change_year

svg_now(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	#clock=`date "+%R"`
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="300" height="20">
  <rect width="300" height="20" style="fill:none; stroke-width:0" />
  <text x="2" y="90%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="left">'$1'</text>
</svg>' > "$3"
}
export -f svg_now

svg_word(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="200" height="30">
  <rect width="200" height="30" style="fill:none; stroke-width:0" />
  <text x="2" y="70%" style="fill:black; font-family:sans; font-weight:bold; font-size:'$2';" text-anchor="left">'$1'</text>    
</svg>' > "$3"
}
export -f svg_word

svg_number(){
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="30" style="fill:none; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number

svg_number_selected(){
	color=`cat selected_color`
	if [ "$color" == "" ];then color="#0077D6";fi
	echo '<?xml version="1.0" encoding="UTF-8"?>
<svg width="30" height="30">
  <rect width="30" height="5" y="25" style="fill:'$color'; stroke-width:0" />
  <text x="50%" y="70%" style="fill:black; font-weight:bold; font-family:sans; font-size:'$2';" text-anchor="middle">'$1'</text>    
</svg>' > "$3"
}
export -f svg_number_selected

svg_number_click(){
	for i in {1..7};do
		for j in {1..7};do
			sed -i '/circle/d' number/grid_$i$j.svg
		done
	done	
	sed -i '2 a <circle cx="15" cy="2" r="2" style="fill:#FFA500" />' "$1"
	d=`grep -o ">.*</text>" "$1" |sed 's/>//g'|cut -d\< -f1|sed 's/^ *//g'`
	m=`cat month`
	y=`cat year`
	if [[ $d =~ [0-9] ]];then
	click_date=`date -d "$y-$m-$d" "+%A, %d %B %Y"`
	else
		click_date="Not a date"
	fi
	echo "$click_date"
	echo "$click_date" > click_date
}
export -f svg_number_click


refresh_btn_grid(){
	echo '				<action>refresh:long_button</action>'
	for i in {1..7};do
		for j in {1..7};do
			echo '				<action>refresh:btn_grid_'$i$j'</action>'
		done
	done	
}

refresh_btn2(){
	echo '				<action>refresh:long_button2</action>'
	for i in {1..12};do
		echo '				<action>refresh:btn2_'$i'</action>'
	done	
}

refresh_btn3(){
	echo '				<action>refresh:long_button3</action>'
	for i in {1..5};do
		for j in {1..4};do
			echo '				<action>refresh:btn3_'$i$j'</action>'
		done
	done	
}

change_two_decades(){
	change="$1"
	Y=`cat year`
	
	if [ "$1" == "+1" ];then
		Y=$((Y+20))
	elif [ "$1" == "-1" ];then
		Y=$((Y-20))
	fi
	echo "$Y" > year
	
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	Y=$((Y-1))
	svg_word "$tly - $Y" 20 number/two_decades.svg	
}
export -f change_two_decades

month_to_year(){
	y=`cut -d "-" -f1 year_month`
	svg_word "$y" 20 number/year.svg
	
	m=`cat month`
	for i in {1..12};do
		b=`date -d "2022-$i-1" "+%b"`
		
		if [ "$i" == "$m" ];then
			svg_number_selected "$b" 14 number/grid2_$i.svg
		else
			svg_number "$b" 14 number/grid2_$i.svg
		fi
	done
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f month_to_year

year_to_month(){
	m=`cat month`
	y=`cat year`
	#BY=`date -d "$y-$m-1" "+%B %Y"`
	#svg_word "$BY" 20 number/monthyear.svg
	amonth "$m" "$y"
	echo 0 > tabpos
}
export -f year_to_month

year_to_two_decades(){
	Y=`cat year`
	tly=$((Y-(Y%20)+1))	
	Y="$tly"
	for i in {1..5};do
		for j in {1..4};do
			svg_number "$Y" 12 number/grid3_$i$j.svg
			((Y++))
		done
	done
	svg_word "$tly - $((Y-1))" 20 number/two_decades.svg
	
	
	echo 2 > tabpos
}
export -f year_to_two_decades

two_decades_to_year(){
	y=`grep -o ">.*</text>" number/"$1" |sed 's/>//g'|cut -d\< -f1`
	
	svg_word "$y" 20 number/year.svg
	
	echo "$y" > year
	echo 1 > tabpos
}
export -f two_decades_to_year


now(){
	today=`date "+%A, %d %B %Y"`
	svg_now "$today" 11 number/today.svg
	amonth
	echo 0 > tabpos
	
	echo "$today"
	echo "$today" > click_date
}
export -f now


# make arrow
echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,11 15,18 23,11" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/next.svg

echo '<?xml version="1.0" encoding="UTF-8"?>
<svg height="30" width="30">
  <path d="M7,18 15,11 23,18" stroke="black" stroke-width="1" fill="none"/>
</svg>' > number/previous.svg



#amonth 4
#amonth
now






echo '
<window title="kalendermuks">
<vbox spacing="0">

<button xalign="0" relief="2" padding="0">
	<input file>number/today.svg</input>
	<action>now</action>
	<action>refresh:nb_kalender</action>
	<action>grabfocus:'"`cat btn_today`"'</action>
	'"`refresh_btn_grid`"'
</button>
<hseparator></hseparator>

<notebook show-tabs="false" show-border="false" >
<vbox spacing="0">
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/monthyear.svg</input>
			<action>month_to_year</action>
			<action>refresh:nb_kalender</action>
			'"`refresh_btn2`"'
			<variable>long_button</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_month -1</action>
			'"`refresh_btn_grid`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_month 1</action>
			'"`refresh_btn_grid`"'
		</button>
		
	</hbox>
'"`btn`"'
	
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0">
			<input file>number/year.svg</input>
			<action>year_to_two_decades</action>
			<action>refresh:nb_kalender</action>
			'"`refresh_btn3`"'
			<variable>long_button2</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_year -1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_year +1</action>
			<action>refresh:long_button2</action>
			
		</button>
		
	</hbox>
	'"`btn2`"'
</vbox>

<vbox>
	<hbox spacing="0">
		<button relief="2" width-request="230" height-request="40" xalign="0" sensitive="false">
			<input file>number/two_decades.svg</input>
			<variable>long_button3</variable>
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/previous.svg</input>
			<action>change_two_decades -1</action>
			<action>year_to_two_decades</action>
			'"`refresh_btn3`"'
		</button>
		
		<button relief="2" width-request="46" height-request="40">
			<input file>number/next.svg</input>
			<action>change_two_decades +1</action>
			'"`refresh_btn3`"'
		</button>
		
	</hbox>
	'"`btn3`"'
</vbox>
<input file>tabpos</input>
<variable>nb_kalender</variable>
</notebook>

</vbox>

<action signal="focus-in-event">grabfocus:'`cat btn_today`'</action>
<action signal="key-press-event" condition="command_is_true([ $KEY_SYM = Escape ] && echo true )">exit:Esc</action>
</window>' > guikalender

gtkdialog -f guikalender
Attachments
bug1.jpg
bug1.jpg (193.56 KiB) Viewed 1073 times
User avatar
misko_2083
Posts: 196
Joined: Wed Dec 09, 2020 11:59 pm
Has thanked: 10 times
Been thanked: 20 times

Re: Gtkdialog Calendar

Post by misko_2083 »

recobayu wrote: Thu Feb 24, 2022 12:51 am

I found the `date' command has limitation.

Code: Select all

# date --date='2038-1-20'
date: invalid date ‘2038-1-20’
# date --date='2038-1-19'
Tue Jan 19 12:00:00 AM WIB 2038
# 

The max date that still can be reach is on 19 Jan 2038.
But when I use minixcal, it can reach year 2309
Is there any replacement of date command in linux?

There is awk, but not POSIX, that is if you even care about that.

man awk https://www.gnu.org/software/gawk/manua ... tions.html
^^^Scroll down to the bottom of the page where there is a script example of awk reproducing the date command behavior and formatting..

mktime Turn a datespec (YYYY MM DD HH MM SS) into a timestamp
strftime Format a specified time to the given format as defined by strftime()
systime Return the Unix Time stamp (Epoch)

Code: Select all

awk 'BEGIN { print "Seconds since Epoch: " mktime("2038 1 20 1 1 1") }'
Seconds since Epoch: 2147558461

awk 'BEGIN { print "Seconds since Epoch: " systime() }'
Seconds since Epoch: 1646043482

awk 'BEGIN { print strftime("Today is %A, %B %d, %Y.", systime()) }'
Today is Monday, February 28, 2022.

The Bash printf builtin command also support some date formats
by using %(datefmt)T where datefmt is a format string passed to
strftime and the corresponding argument is the Epoch time.

Code: Select all

TZ=UTC printf "%(%F)T\n" 2147558461
2038-01-20

TZ=UTC printf "This date occurred in week %(%W)T of the year %(%Y)T\n" $EPOCHSECONDS
This date occurred in week 09 of the year 2022

Do you want to exit the Circus? The Harsh Truth
https://www.youtube.com/watch?v=ZJwQicZHp_c

User avatar
puppy_apprentice
Posts: 661
Joined: Tue Oct 06, 2020 8:43 pm
Location: land of bigos and schabowy ;)
Has thanked: 4 times
Been thanked: 107 times

Re: Gtkdialog Calendar

Post by puppy_apprentice »

An MM attempt on this topic.

don570
Posts: 624
Joined: Sat Nov 21, 2020 4:43 pm
Has thanked: 5 times
Been thanked: 98 times

Re: Gtkdialog Calendar

Post by don570 »

to recobayu

Very nice coding.
I might suggest a button to open a text file to act like a diary.
The date and a message could be entered and stored in the text file.


Zigbert who wrote pfind was one of the first coders that took advantage of SVG images


Post Reply

Return to “Programming”