11#!/usr/bin/env python3
22# -*- coding: UTF-8 -*-
3- #
4- # generated by wxGlade 1.0.1 on Wed Mar 31 23:50:32 2021
5- #
63
74import wx
85from wx .adv import TaskBarIcon as TaskBarIcon
1310from pypresence import Presence
1411import time
1512
16- ########### JSON
17-
1813import json
1914conf = open ('config.json' )
2015config = json .load (conf )
3126button_label2 = config ['Main' ]['button_label2' ]
3227button_url2 = config ['Main' ]['button_url2' ]
3328
34- #####################
3529cd = dir_path = os .path .dirname (os .path .realpath (__file__ ))
36- # begin wxGlade: dependencies
37- # end wxGlade
38-
39- # begin wxGlade: extracode
40- # end wxGlade
4130
42- ################################################################################
4331# PLEASE DON'T REMOVE THESE. IF YOU DO, PLEASE GIVE CREDIT WHEN ASKED ABOUT THE PROGRAM, THANK YOU!!
4432
4533
4836RPC .connect ()
4937RPC .update (state = "Checkout the Github!" , large_image = "logo" ,large_text = "Discord Custom RPC" , buttons = [{"label" : "Github" , "url" : "https://github.com/Rayrsn/Discord-Custom-RPC" }])
5038
51- ################################################################################
52-
5339class DemoTaskBarIcon (TaskBarIcon ):
5440 TBMENU_RESTORE = wx .NewIdRef ()
5541 TBMENU_CLOSE = wx .NewIdRef ()
@@ -60,15 +46,13 @@ def __init__(self, frame):
6046 TaskBarIcon .__init__ (self , wx .adv .TBI_DOCK )
6147 self .frame = frame
6248
63- # Set the image
6449 img = wx .Image ("icon.ico" , wx .BITMAP_TYPE_ANY )
6550 bmp = wx .Bitmap (img )
6651 self .icon = Icon (bmp )
6752 self .icon .CopyFromBitmap (bmp )
6853 self .SetIcon (self .icon , "Discord Custom RPC" )
6954 self .imgidx = 1
7055
71- # bind some events
7256 self .Bind (wx .adv .EVT_TASKBAR_LEFT_DCLICK , self .OnTaskBarActivate )
7357 self .Bind (wx .EVT_MENU , self .OnTaskBarActivate , id = self .TBMENU_RESTORE )
7458 self .Bind (wx .EVT_MENU , self .OnTaskBarClose , id = self .TBMENU_CLOSE )
@@ -124,7 +108,6 @@ def OnTaskBarRemove(self, evt):
124108
125109class frameclass (wx .Frame ):
126110 def __init__ (self , * args , ** kwds ):
127- # begin wxGlade: frameclass.__init__
128111 kwds ["style" ] = kwds .get ("style" , 0 ) | wx .CAPTION | wx .CLIP_CHILDREN | wx .CLOSE_BOX | wx .MAXIMIZE_BOX | wx .MINIMIZE_BOX | wx .SYSTEM_MENU
129112 wx .Frame .__init__ (self , * args , ** kwds )
130113 self .SetSize ((470 , 620 ))
@@ -311,7 +294,6 @@ def __init__(self, *args, **kwds):
311294 self .panel_1 .SetSizer (grid_sizer_1 )
312295
313296 self .Layout ()
314- # end wxGlade
315297
316298 self .Bind (wx .EVT_BUTTON , self .updatefunc , self .button_1 )
317299 self .Bind (wx .EVT_BUTTON , self .dcfunc , self .button_2 )
@@ -328,7 +310,6 @@ def __init__(self, *args, **kwds):
328310 self .Bind (wx .EVT_TEXT , self .get_textbox_url_btn2 , self .text_ctrl_8 )
329311 self .Bind (wx .EVT_ICONIZE , self .onMinimize )
330312 self .Bind (wx .EVT_CLOSE , self .onClose )
331- #self.Bind(wx.EVT_BUTTON, self.Onmsgbox)
332313 self .text_ctrl_1 .ChangeValue (client_id )
333314 self .text_ctrl_2 .ChangeValue (details )
334315 self .text_ctrl_3 .ChangeValue (state )
@@ -342,7 +323,6 @@ def __init__(self, *args, **kwds):
342323 self .text_ctrl_8 .ChangeValue (button_url2 )
343324
344325 self .tbicon = DemoTaskBarIcon (self )
345- ###############################################################################
346326
347327 def get_textbox_client_id (self , evt ):
348328 client_id_ent = (str (self .text_ctrl_1 .GetValue ()))
@@ -491,21 +471,15 @@ def dcfunc(self, evt):
491471
492472 def onClose (self , evt ):
493473
494- # if self.tbicon is not None:
495- # self.tbIcon.RemoveIcon()
496- # self.tbicon.Destroy()
497474 self .Destroy ()
498475 sys .exit ()
499476
500- #----------------------------------------------------------------------
501477 def onMinimize (self , event ):
502478 if self .IsIconized ():
503479 self .Hide ()
504480
505- # end of class frameclass
506481class popup (wx .Dialog ):
507482 def __init__ (self , * args , ** kwds ):
508- # begin wxGlade: popup.__init__
509483 kwds ["style" ] = kwds .get ("style" , 0 ) | wx .DEFAULT_DIALOG_STYLE
510484 wx .Dialog .__init__ (self , * args , ** kwds )
511485 self .SetTitle ("Invalid Client ID" )
@@ -548,7 +522,6 @@ def OnInit(self):
548522 self .frame .Show ()
549523 return True
550524
551- # end of class appclass
552525if __name__ == "__main__" :
553526 app = appclass (0 )
554- app .MainLoop ()
527+ app .MainLoop ()
0 commit comments