How can I change the application indicator label after delay?












3















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.










share|improve this question





























    3















    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.










    share|improve this question



























      3












      3








      3


      2






      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.










      share|improve this question
















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 18 '12 at 16:17









      Jorge Castro

      36.5k106422617




      36.5k106422617










      asked Jun 14 '12 at 20:24









      user70670user70670

      161




      161






















          1 Answer
          1






          active

          oldest

          votes


















          2














          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!






          share|improve this answer


























          • 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











          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
          });


          }
          });














          draft saved

          draft discarded


















          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









          2














          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!






          share|improve this answer


























          • 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
















          2














          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!






          share|improve this answer


























          • 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














          2












          2








          2







          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!






          share|improve this answer















          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!







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Jan 22 at 14:09









          whtyger

          4,38332236




          4,38332236










          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 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



















          • 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

















          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


















          draft saved

          draft discarded




















































          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.




          draft saved


          draft discarded














          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





















































          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







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

           ⁒  ․,‪⁊‑⁙ ⁖, ⁇‒※‌, †,⁖‗‌⁝    ‾‸⁘,‖⁔⁣,⁂‾
”‑,‥–,‬ ,⁀‹⁋‴⁑ ‒ ,‴⁋”‼ ⁨,‷⁔„ ‰′,‐‚ ‥‡‎“‷⁃⁨⁅⁣,⁔
⁇‘⁔⁡⁏⁌⁡‿‶‏⁨ ⁣⁕⁖⁨⁩⁥‽⁀  ‴‬⁜‟ ⁃‣‧⁕‮ …‍⁨‴ ⁩,⁚⁖‫ ,‵ ⁀,‮⁝‣‣ ⁑  ⁂– ․, ‾‽ ‏⁁“⁗‸ ‾… ‹‡⁌⁎‸‘ ‡⁏⁌‪ ‵⁛ ‎⁨ ―⁦⁤⁄⁕