my-weather-indicator applet

Technical issues/questions of an intermediate or advanced nature.
User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#31 by Rava » 07 Feb 2019, 00:16

Ed_P wrote:
06 Feb 2019, 23:54
I don't have a /home/guest/.bashrc file.
Really? It should be part of 001-core.xzm:

Code: Select all

guest@porteus:/mnt/live/memory/images$ find .|grep .bashrc
./001-core.xzm/home/guest/.bashrc
./001-core.xzm/root/.bashrc
Are you sure you are running Porteus? 001-core is independent of what DE you are using.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#32 by Ed_P » 07 Feb 2019, 00:57

:o Oh!

Code: Select all

guest@porteus:~$ find .|grep .bashrc
./.bashrc
guest@porteus:~$ ls ./.bashrc
./.bashrc
guest@porteus:~$ cat ./.bashrc
# Setup color scheme <brokenman> for list call
alias ll='/bin/ls --color=auto -lF'
alias la='/bin/ls --color=auto -axF'
alias ls='/bin/ls --color=auto -xF'

# Append any additional sh scripts found in /etc/profile.d/:
 :
 :
In nemo I was putting /home/guest/.bachrc in the address bar and it wasn't finding it. It's not a folder, its a file!! :shock:

I've been here 6 yrs, to the day actually, and I'm still learning new things. :happy62:
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#33 by Rava » 07 Feb 2019, 06:24

Ed_P wrote:
07 Feb 2019, 00:57
In nemo I was putting /home/guest/.bachrc in the address bar and it wasn't finding it. It's not a folder, its a file!! :shock:
And actually it is not .bachrc either.
Ed_P wrote:
07 Feb 2019, 00:57
I've been here 6 yrs, to the day actually, and I'm still learning new things. :happy62:
Unlike with AppleOS or SM-Witless, you tend to learn stuff on Linux. Not just, as we call it in German, Clicky-Bunty, could be translated as Clicky-Colour'y, meaning it is only about the GUI, and never about a shell, a terminal or a virtual terminal.

But often, this is where the real fun starts. You might have to first learn some stuff, but with scripts it is like so: It sure takes time to code one. But when you did code one successfully, quite some scripts do the menial repeating tasks for you, and it might have taken half a day, or maybe even two days to finally finish a certain script, but from now on, you just start it, probably with parameter or parameters, and the PC is doing what it was supposed to do from the very beginning: it is working on its own, and you just have to direct it towards what it should do.

While Clicky-Colour'y, meaning you have to do every single small thing by yourself, doing every task by hand, and not having the PC doing stuff automated at all.

Have you tried adding my psg function to your ~/.bashrc ? That way you would learn a bit more about why functions are such a neat concept, especially outside of scripts.
___________________________________________________

The nice thing with functions, there are quite some stuff that won't work with an alias. But works as a function. Image

I never could figure out why that was, but with my three commands dx, fx and sx (all displaying a date+time info including a separator line, then executing a variant of df, free and cat /proc/swaps respectively) fx is the only that works as an alias. dx and sx won't work as intended and had to be coded as functions. sx, the changed to MB info of cat /proc/swaps is more complex, but fx and dx seem quite similar on the surface, but with dx, it never worked as it should, displaying an outdated date+time info line, and I could never figure out why that was. The only solution I was able to come up with is changing dx from an alias to a function and then it worked as intended.

Some of the questions about certain coding issues I did ask on here ( https://forum.porteus.org ) , and some have been unanswered ever since. But that's life. Image Most of the times I got good helpful replies. Image
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#34 by Rava » 07 Feb 2019, 15:15

Anyhow, back on topic and about simple-weather-indicator-x86_64-20190206.xzm

It is all fine that it set the measurements to °C / km / km/h by itself, but sadly I don't see an option to also set the time format to get rid the pesky am/pm thingy. In German speaking countries, and in most countries surrounding these we use the 24 hours time format, also known to some as military time. (We do use "4 o'clock" in informal speech when it is obvious the afternoon is meant, but we never use "4 am" or "4 pm.")

Any one has an idea how I can change that in simple-weather-indicator? "Last update: 04:03:16 pm" sounds so weird to me, and I dislike software that forces me to use a measurement I don't want to use. I prefer "Last update: 16:03:16".
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#35 by Ed_P » 07 Feb 2019, 16:07

Rava wrote:
07 Feb 2019, 06:24
Have you tried adding my psg function to your ~/.bashrc ? That way you would learn a bit more about why functions are such a neat concept, especially outside of scripts.

Code: Select all

guest@porteus:~$ psg weath
 2501 ?        Sl     0:02 python /usr/bin/indicator-weather
guest@porteus:~$ 
Of course I have no idea what it means. :lol:
Rava wrote:
07 Feb 2019, 15:15
Any one has an idea how I can change that in simple-weather-indicator? "Last update: 04:03:16 pm" sounds so weird to me, and I dislike software that forces me to use a measurement I don't want to use. I prefer "Last update: 16:03:16".
Picky, picky, picky. *HERE*

I would like to be able to control the frequency of update and have an icon appear in the panel. Basically we have 3 options; accept the app as it is, request it's creator change it, write our own.
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#36 by Rava » 07 Feb 2019, 20:17

Ed_P wrote:
07 Feb 2019, 16:07

Code: Select all

guest@porteus:~$ psg weath
 2501 ?        Sl     0:02 python /usr/bin/indicator-weather
guest@porteus:~$ 
Of course I have no idea what it means. :lol:
psg stands for ps grep. The only trick is that it omits the grep part itself, so, searching anything with "grep" in it will fail. I was just annoyed that I always got one hit more than I wanted, so I came up with omitting grep itself. That's what the "| /bin/grep -v grep" part is doing. :)
Ed_P wrote:
07 Feb 2019, 16:07
Picky, picky, picky. *HERE*
Not every one is USA based, would you like it when every software forced °C, metre and military time on you?
Instead of the ° you are used to, imperial measurements and am/pm.
Ed_P wrote:
07 Feb 2019, 16:07
I would like to be able to control the frequency of update and have an icon appear in the panel. Basically we have 3 options; accept the app as it is, request it's creator change it, write our own.
Oh, requesting is always good, at times it succeeds, at times it does not. But we should think positively, we don't know the person or persons who coded it, so maybe she or he would appreciate our input. :)
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

simple-weather-indicator-x86_64-20190206

Post#37 by Rava » 08 Feb 2019, 06:01

Rava wrote:
07 Feb 2019, 20:17
Oh, requesting is always good, at times it succeeds, at times it does not. But we should think positively, we don't know the person or persons who coded it, so maybe she or he would appreciate our input. :)
And a bug report. But since I don't know for which DE the simple-weather-indicator-x86_64-20190206.xzm is meant to run, it is questionable if the application creator(s) would be interested in that bug report below at all. Since Openbox ( running on a dev version of a live Linux to boot) is not a DE, but a mere simple window manager.

So, when I awoke today morning, and Porteus came out of suspend, I wanted to let simple-weather-indicator know that I want an update right now, by clicking "Refresh" in its menu. An like the last time, it did not react after that, clicking on the icon did nothing. Trying to see if the top info of it gave some more info, e.g. if it switched into zombie mode (the worst case scenario, kinda) I again asked my function psg (details above)

Code: Select all

guest@porteus:/$ psg weath
 5425 tty2     Sl     0:04 python /usr/bin/indicator-weather
26053 tty2     Sl     0:06 python /usr/bin/indicator-weather
guest@porteus:/$ kill 5425
guest@porteus:/$ psg weath
26053 tty2     Sl     0:06 python /usr/bin/indicator-weather
guest@porteus:/$ kill 26053
guest@porteus:/$ psg weath
guest@porteus:/$ ( indicator-weather & 2>&1 >/dev/null )
(indicator-weather:13262): Gdk-CRITICAL **: 06:38:36.8 & 2>&1 >/dev/null )97: gdk_window_thaw_toplevel_updates: assertion 'window->update_and_descendants_freeze_count > 0' failed
guest@porteus:/$ psg weath
13262 pts/3    Sl     0:02 python /usr/bin/indicator-weather
As you can see, for some weird reason, after I did click "update", and wanted to see what goes one via consulting top, there have been again two instances of /usr/bin/indicator-weather aka "-> ../lib/ubuntu-indicator-weather/indicator-weather" running. But maybe this is as it should be, maybe the "update" does indeed start a new version that just updates the data and then lets the already running in the tray version know that data got updated. I have no clue how the python script is doing stuff, for now I did not look into its code.
*cough* Since its python code and not a compiled program, one might even tweak aka hack the script itself to get it behave like we want, e.g. the 24 hours time format thingy. *cough* But in my book, since I rarely code in python, it all depends on how well the script code is documented. *cough*
So, I killed both instances as you can see below.

Then I started it via ( progname & 2>&1 >/dev/null ) and that should do two things, make it independent of the terminal so that it keeps running even when the starting terminal got closed, and also suppress all warning or error or any other kind of messages via the "2>&1 >/dev/null" part. But it did not suppress the messages, and I have no clue why it did not do so. Image Any tips on why the suppression of messages did fail are greatly appreciated.

As you can see, now, started anew, there is again only one instance running. And that one instance sure did update its data recently. But I cannot know if it was due to the kinda failed update or if its just asking for new data, since it was just started and all.
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#38 by Ed_P » 08 Feb 2019, 17:17

I wonder if your network connect was in hibernate mode when the weather update tried to run causing it to hang. Next time, do your psg before clicking on the refresh option and then after. Also try killing just the 2nd task before the older one.
Rava wrote:clicking on the icon did nothing. Trying to cguest@porteus:/$ kill 26053heck if the top info of it gave some info, e.g. if
Ya might want to edit this line. :)
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#39 by Rava » 08 Feb 2019, 17:40

^
funny enough, I wanted to type "check" and it made "heck" out of it, making me look like I did swear. That is the downside by Dr. Copy & Mr. Paste, when you use the mouse buffer to do it instead of the system clipboard, it always inserts text at mouse position and not at cursor position. Unless you are using it in a text terminal, that is.

Thanks for pointing it out to me. :)
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#40 by Ed_P » 09 Feb 2019, 00:42

Interesting. :)

http://eris.madadipouya.com/

/usr/lib/ubuntu-indicator-weather

Code: Select all

 17 # Author(s):
 18 # (C) 2015 Kasra Madadipouya <kasra@madadipouya.com>

250         last_update = 'Last Update: ' + time.strftime("%I:%M:%S %p")
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#41 by Rava » 09 Feb 2019, 14:25

Ed_P wrote:
09 Feb 2019, 00:42

Code: Select all

250         last_update = 'Last Update: ' + time.strftime("%I:%M:%S %p")
That seems to be the line. :D

And this https://docs.python.org/3.5/library/tim ... e.strftime is the needed info for tweaking the python code. Lets pull out the hacking gloves and get to work. Image

Code: Select all

root@porteus:~# diff /usr/lib/ubuntu-indicator-weather/indicator-weather /mnt/live/memory/images/simple-weather-indicator-x86_64-20190206.xzm/usr/lib/ubuntu-indicator-weather/indicator-weather 
19c19
< ## ## hacked into using 24 hrs time format by Rava@porteus, thanks to Ed_P@porteus for pointing the code line out to me.
---
> 
250c250
<         last_update = 'Last Update: ' + time.strftime("%H:%M:%S")
---
>         last_update = 'Last Update: ' + time.strftime("%I:%M:%S %p")
Image
Image Image Image

Code: Select all

443fb7b83bf10060384acc607a35386d  025-simple-weather-indicator-x86_64-20190206_rava_hacked.xzm
1351680 bytes (1.29 MB)
I could upload it if anyone's interested, or just apply the above diff yourself. :happy62:
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#42 by Ed_P » 09 Feb 2019, 21:39

:)
:Bravo: :thumbsup:
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#43 by Rava » 10 Feb 2019, 05:07

^
It was one of the most easy fixes I ever did. Image And it was also fun doing the hacking, :D
Cheers!
Yours Rava

User avatar
Ed_P
Contributor
Contributor
Posts: 8343
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: my-weather-indicator applet

Post#44 by Ed_P » 10 Feb 2019, 06:05

Did you have to do anything special after changing line 250, like recycle the DE, reinstall simple weather or a submodule?
Ed

User avatar
Rava
Contributor
Contributor
Posts: 5401
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.01 x86_64 + 4.0 i586
Location: Forests of Germany

Re: my-weather-indicator applet

Post#45 by Rava » 10 Feb 2019, 12:38

Ed_P wrote:
10 Feb 2019, 06:05
Did you have to do anything special after changing line 250, like recycle the DE, reinstall simple weather or a submodule?
No, I tested the python script file itself, prior creating my hacked_rava.xzm module. I just exited simple weather Indicator and restarted it via Menu/Utility/Simple Weather Indicator.

And since it is a python script, it not needs anything more than that. Even now, officially the module by ncmprhnsbl is the loaded one. I just put my own hacked module into the /base/ but have to reboot to physically load it. But it makes no difference, both use the patched/hacked python code.
Cheers!
Yours Rava

Post Reply