Preference File

More
24 May 2020 01:41 - 24 May 2020 02:32 #168755 by cmorley
Replied by cmorley on topic Preference File
Sorry for the bum steer - 'periodic' is the STATUS message that will get called every 100ms
docs for messages: linuxcnc.org/docs/2.8/html/gui/GStat.html

I'm just about to push some work in that library to make this easier.
So the command- messages are missing until i push, ( if you are impatient you could do the same by combining interp states)

but this is how one might do it (Not tested)
import time
self.startTime = 0

STATUS.connect('periodic', self.set_timestamp)
STATUS.connect('command-running', lambda w: self.get_time())
STATUS.connect('command-stopped', lambda w: self.stop_time())

def get_time(self):
    self.startTime = time.time()
    self.timerOn = True

def stop_time(self):
    self.timerOn = False

def set_timestamp(self):
    if self.timerOn:
        self.w.labelWidget.setText(time.time() - self.startTime)
    else:
         self.w.labelWidget.setText('Run Timer Off')

Chris
Last edit: 24 May 2020 02:32 by cmorley.
The following user(s) said Thank You: hottabich

Please Log in or Create an account to join the conversation.

More
24 May 2020 02:02 #168756 by persei8
Replied by persei8 on topic Preference File
I figured it must be periodic. When buildbot updates in 2 or 3 days, I will make the change.

Please Log in or Create an account to join the conversation.

More
24 May 2020 18:18 #168814 by persei8
Replied by persei8 on topic Preference File
OK - done.
The following user(s) said Thank You: hottabich

Please Log in or Create an account to join the conversation.

More
25 May 2020 05:14 #168844 by cmorley
Replied by cmorley on topic Preference File
excellent.
I just pushed some work so the styleeditor can be used to select the style to be loaded at startup. Probably not intuitive but it's a start. (the last applied style from the combobox is saved in the preference file.)
Also now if you open a saved style, it's added to the combobox.
The following user(s) said Thank You: hottabich

Please Log in or Create an account to join the conversation.

Moderators: cmorley
Time to create page: 0.078 seconds
Powered by Kunena Forum