How can I change the application indicator label after delay?
How can I change the Application Indicator label after delay
self.ind = appindicator.Indicator("new-gmail-indicator", "/usr/share/icons/ubuntu-mono-dark/status/16/ubuntuone-client-error.svg", appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_label("SSH")
time.sleep(4)
self.ind.set_label("HSS")
The application runs but I only see the HSS
label when running the application. I never see SSH
.
indicator python
add a comment |
How can I change the Application Indicator label after delay
self.ind = appindicator.Indicator("new-gmail-indicator", "/usr/share/icons/ubuntu-mono-dark/status/16/ubuntuone-client-error.svg", appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_label("SSH")
time.sleep(4)
self.ind.set_label("HSS")
The application runs but I only see the HSS
label when running the application. I never see SSH
.
indicator python
add a comment |
How can I change the Application Indicator label after delay
self.ind = appindicator.Indicator("new-gmail-indicator", "/usr/share/icons/ubuntu-mono-dark/status/16/ubuntuone-client-error.svg", appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_label("SSH")
time.sleep(4)
self.ind.set_label("HSS")
The application runs but I only see the HSS
label when running the application. I never see SSH
.
indicator python
How can I change the Application Indicator label after delay
self.ind = appindicator.Indicator("new-gmail-indicator", "/usr/share/icons/ubuntu-mono-dark/status/16/ubuntuone-client-error.svg", appindicator.CATEGORY_APPLICATION_STATUS)
self.ind.set_label("SSH")
time.sleep(4)
self.ind.set_label("HSS")
The application runs but I only see the HSS
label when running the application. I never see SSH
.
indicator python
indicator python
edited Jun 18 '12 at 16:17
Jorge Castro
36.8k106422617
36.8k106422617
asked Jun 14 '12 at 20:24
user70670user70670
161
161
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
The problem here is that you've got a single threaded application, and the sleep is blocking it, thus the AppIndicator library doesn't get a chance to update the label. What you need to do for your timeout is use GLib's timeout function to set up a delay, and change the label in that callback. The code would probably look something like:
def set_label(self):
self.ind.set_label("SSH")
GLib.timeout_add(4, self.respond_to_timeout)
def respond_to_timeout(self):
self.ind.set_label("HSS")
Good luck!
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives meSegmentation fault (core dumped)
error. I also tried totally separate thread but it give meFatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.
– moshfiqur
May 2 '14 at 16:43
TryGLib.timeout_add_seconds
instead.
– whtyger
Jan 22 at 14:07
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f150970%2fhow-can-i-change-the-application-indicator-label-after-delay%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The problem here is that you've got a single threaded application, and the sleep is blocking it, thus the AppIndicator library doesn't get a chance to update the label. What you need to do for your timeout is use GLib's timeout function to set up a delay, and change the label in that callback. The code would probably look something like:
def set_label(self):
self.ind.set_label("SSH")
GLib.timeout_add(4, self.respond_to_timeout)
def respond_to_timeout(self):
self.ind.set_label("HSS")
Good luck!
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives meSegmentation fault (core dumped)
error. I also tried totally separate thread but it give meFatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.
– moshfiqur
May 2 '14 at 16:43
TryGLib.timeout_add_seconds
instead.
– whtyger
Jan 22 at 14:07
add a comment |
The problem here is that you've got a single threaded application, and the sleep is blocking it, thus the AppIndicator library doesn't get a chance to update the label. What you need to do for your timeout is use GLib's timeout function to set up a delay, and change the label in that callback. The code would probably look something like:
def set_label(self):
self.ind.set_label("SSH")
GLib.timeout_add(4, self.respond_to_timeout)
def respond_to_timeout(self):
self.ind.set_label("HSS")
Good luck!
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives meSegmentation fault (core dumped)
error. I also tried totally separate thread but it give meFatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.
– moshfiqur
May 2 '14 at 16:43
TryGLib.timeout_add_seconds
instead.
– whtyger
Jan 22 at 14:07
add a comment |
The problem here is that you've got a single threaded application, and the sleep is blocking it, thus the AppIndicator library doesn't get a chance to update the label. What you need to do for your timeout is use GLib's timeout function to set up a delay, and change the label in that callback. The code would probably look something like:
def set_label(self):
self.ind.set_label("SSH")
GLib.timeout_add(4, self.respond_to_timeout)
def respond_to_timeout(self):
self.ind.set_label("HSS")
Good luck!
The problem here is that you've got a single threaded application, and the sleep is blocking it, thus the AppIndicator library doesn't get a chance to update the label. What you need to do for your timeout is use GLib's timeout function to set up a delay, and change the label in that callback. The code would probably look something like:
def set_label(self):
self.ind.set_label("SSH")
GLib.timeout_add(4, self.respond_to_timeout)
def respond_to_timeout(self):
self.ind.set_label("HSS")
Good luck!
edited Jan 22 at 14:09
whtyger
4,40832236
4,40832236
answered Jun 15 '12 at 13:11
Ted GouldTed Gould
3,3081123
3,3081123
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives meSegmentation fault (core dumped)
error. I also tried totally separate thread but it give meFatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.
– moshfiqur
May 2 '14 at 16:43
TryGLib.timeout_add_seconds
instead.
– whtyger
Jan 22 at 14:07
add a comment |
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives meSegmentation fault (core dumped)
error. I also tried totally separate thread but it give meFatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.
– moshfiqur
May 2 '14 at 16:43
TryGLib.timeout_add_seconds
instead.
– whtyger
Jan 22 at 14:07
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives me
Segmentation fault (core dumped)
error. I also tried totally separate thread but it give me Fatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.– moshfiqur
May 2 '14 at 16:43
I wanted to do similar thing and I also tried GLib's timeout_add method but it gives me
Segmentation fault (core dumped)
error. I also tried totally separate thread but it give me Fatal Python error: ceval: tstate mix-up Aborted (core dumped)
. Though it's an old question, but still hoping to find a solution.– moshfiqur
May 2 '14 at 16:43
Try
GLib.timeout_add_seconds
instead.– whtyger
Jan 22 at 14:07
Try
GLib.timeout_add_seconds
instead.– whtyger
Jan 22 at 14:07
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f150970%2fhow-can-i-change-the-application-indicator-label-after-delay%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown