ScreamMyName 100 Posted March 13, 2015 Share Posted March 13, 2015 Hi guys I'm in the middle of coding my first login window. I have one last thing to do and I could it with socket ble ble but I guess it's kinda lame. So can someone show me any examples of how can I get the state of the channel and depending on either it's online or offline change the buttons ? (green/red) Link to comment Share on other sites More sharing options...
Premium cndR_s 242 Posted March 13, 2015 Premium Share Posted March 13, 2015 Use a script in php for check channel status. Then send a request with urllib check = urllib.urlopen("http://webpageadress/check_server.php?status=").read() if check == 1: youserverON else youserverOFF Should work. Link to comment Share on other sites More sharing options...
Premium masodikbela 1367 Posted March 13, 2015 Premium Share Posted March 13, 2015 Well, you can use the ServerStateChecker. You can find it in an original intrologin.py, but I will try to show you how it works. Firstly, you need to create a new ServerStateChecker and give the current python module to this, which means it will call its functions from the current python script (eg. yourNewIntrologin.py). ServerStateChecker.Create(self) You must write it before you wants to do anything with the ServerStateChecker. Do it eg in the Open(self) function, or what you call first when you open the login window. After that write this: ServerStateChecker.Initialize(); ServerStateChecker.AddChannel(id, ip, udp_port) ServerStateChecker.Request() Then create a new function in the same class named NotifyChannelState(self, channelID, state) The ServerStateChecker will trigger this function, and you will get the state of the channel. Then you could do what you want with it. And last but not least, add this to the OnUpdate function: ServerStateChecker.Update() I hope it was understandable and helpful. 1 The one and only UI programming guideline Link to comment Share on other sites More sharing options...
Active Member Koray 2011 Posted March 13, 2015 Active Member Share Posted March 13, 2015 STATE_NONE = "|cFFFF0000|hOFF" STATE_DICT = { 0 : "|cFFFF0000|hOFF", 1 : "|cff00ff00|hNORM", 2 : "|cff00ff00|hBUSY", 3 : "|cff00ff00|hFULL" } 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now