11#!/usr/bin/env python3
22# -*- coding: UTF-8 -*-
3-
4- """
5- ___ ___ ___ ___
6- /\ \ /\ \ |\__\ /\ \
7- /::\ \ /::\ \ |:| | /::\ \
8- /:/\:\ \ /:/\:\ \ |:| | /:/\:\ \
9- /::\~\:\ \ /::\~\:\ \ |:|__|__ /::\~\:\ \
10- /:/\:\ \:\__\ /:/\:\ \:\__\ /::::\__\ /:/\:\ \:\__\
11- \/_|::\/:/ / \/__\:\/:/ / /:/~~/~ \/_|::\/:/ /
12- |:|::/ / \::/ / /:/ / |:|::/ /
13- |:|\/__/ /:/ / \/__/ |:|\/__/
14- |:| | /:/ / |:| |
15- \|__| \/__/ \|__|
16- """
3+ #
4+ # generated by wxGlade 1.0.1 on Wed Mar 31 23:50:32 2021
5+ #
176
187import wx
198from wx .adv import TaskBarIcon as TaskBarIcon
2413from pypresence import Presence
2514import time
2615
16+ ########### JSON
17+
2718import json
2819conf = open ('config.json' )
2920config = json .load (conf )
4031button_label2 = config ['Main' ]['button_label2' ]
4132button_url2 = config ['Main' ]['button_url2' ]
4233
34+ #####################
4335cd = dir_path = os .path .dirname (os .path .realpath (__file__ ))
36+ # begin wxGlade: dependencies
37+ # end wxGlade
4438
39+ # begin wxGlade: extracode
40+ # end wxGlade
41+
42+ ################################################################################
4543# PLEASE DON'T REMOVE THESE. IF YOU DO, PLEASE GIVE CREDIT WHEN ASKED ABOUT THE PROGRAM, THANK YOU!!
4644
4745
5048RPC .connect ()
5149RPC .update (state = "Checkout the Github!" , large_image = "logo" ,large_text = "Discord Custom RPC" , buttons = [{"label" : "Github" , "url" : "https://github.com/Rayrsn/Discord-Custom-RPC" }])
5250
53- class DemoTaskBarIcon (TaskBarIcon ):
51+ ################################################################################
52+
53+ class MainTaskBarIcon (TaskBarIcon ):
5454 TBMENU_RESTORE = wx .NewIdRef ()
5555 TBMENU_CLOSE = wx .NewIdRef ()
5656 TBMENU_CHANGE = wx .NewIdRef ()
@@ -60,13 +60,15 @@ def __init__(self, frame):
6060 TaskBarIcon .__init__ (self , wx .adv .TBI_DOCK )
6161 self .frame = frame
6262
63+ # Set the image
6364 img = wx .Image ("icon.ico" , wx .BITMAP_TYPE_ANY )
6465 bmp = wx .Bitmap (img )
6566 self .icon = Icon (bmp )
6667 self .icon .CopyFromBitmap (bmp )
6768 self .SetIcon (self .icon , "Discord Custom RPC" )
6869 self .imgidx = 1
6970
71+ # bind some events
7072 self .Bind (wx .adv .EVT_TASKBAR_LEFT_DCLICK , self .OnTaskBarActivate )
7173 self .Bind (wx .EVT_MENU , self .OnTaskBarActivate , id = self .TBMENU_RESTORE )
7274 self .Bind (wx .EVT_MENU , self .OnTaskBarClose , id = self .TBMENU_CLOSE )
@@ -122,7 +124,8 @@ def OnTaskBarRemove(self, evt):
122124
123125class frameclass (wx .Frame ):
124126 def __init__ (self , * args , ** kwds ):
125- kwds ["style" ] = kwds .get ("style" , 0 ) | wx .CAPTION | wx .CLIP_CHILDREN | wx .CLOSE_BOX | wx .MAXIMIZE_BOX | wx .MINIMIZE_BOX | wx .SYSTEM_MENU
127+ # begin wxGlade: frameclass.__init__
128+ kwds ["style" ] = kwds .get ("style" , 0 ) | wx .CAPTION | wx .CLIP_CHILDREN | wx .CLOSE_BOX | wx .MINIMIZE_BOX | wx .SYSTEM_MENU
126129 wx .Frame .__init__ (self , * args , ** kwds )
127130 self .SetSize ((470 , 620 ))
128131 self .SetTitle ("Custom RPC" )
@@ -308,6 +311,7 @@ def __init__(self, *args, **kwds):
308311 self .panel_1 .SetSizer (grid_sizer_1 )
309312
310313 self .Layout ()
314+ # end wxGlade
311315
312316 self .Bind (wx .EVT_BUTTON , self .updatefunc , self .button_1 )
313317 self .Bind (wx .EVT_BUTTON , self .dcfunc , self .button_2 )
@@ -324,6 +328,7 @@ def __init__(self, *args, **kwds):
324328 self .Bind (wx .EVT_TEXT , self .get_textbox_url_btn2 , self .text_ctrl_8 )
325329 self .Bind (wx .EVT_ICONIZE , self .onMinimize )
326330 self .Bind (wx .EVT_CLOSE , self .onClose )
331+ #self.Bind(wx.EVT_BUTTON, self.Onmsgbox)
327332 self .text_ctrl_1 .ChangeValue (client_id )
328333 self .text_ctrl_2 .ChangeValue (details )
329334 self .text_ctrl_3 .ChangeValue (state )
@@ -336,7 +341,8 @@ def __init__(self, *args, **kwds):
336341 self .text_ctrl_9 .ChangeValue (button_label2 )
337342 self .text_ctrl_8 .ChangeValue (button_url2 )
338343
339- self .tbicon = DemoTaskBarIcon (self )
344+ self .tbicon = MainTaskBarIcon (self )
345+ ###############################################################################
340346
341347 def get_textbox_client_id (self , evt ):
342348 client_id_ent = (str (self .text_ctrl_1 .GetValue ()))
@@ -485,15 +491,21 @@ def dcfunc(self, evt):
485491
486492 def onClose (self , evt ):
487493
494+ # if self.tbicon is not None:
495+ # self.tbIcon.RemoveIcon()
496+ # self.tbicon.Destroy()
488497 self .Destroy ()
489498 sys .exit ()
490499
500+ #----------------------------------------------------------------------
491501 def onMinimize (self , event ):
492502 if self .IsIconized ():
493503 self .Hide ()
494504
505+ # end of class frameclass
495506class popup (wx .Dialog ):
496507 def __init__ (self , * args , ** kwds ):
508+ # begin wxGlade: popup.__init__
497509 kwds ["style" ] = kwds .get ("style" , 0 ) | wx .DEFAULT_DIALOG_STYLE
498510 wx .Dialog .__init__ (self , * args , ** kwds )
499511 self .SetTitle ("Invalid Client ID" )
@@ -536,6 +548,7 @@ def OnInit(self):
536548 self .frame .Show ()
537549 return True
538550
551+ # end of class appclass
539552if __name__ == "__main__" :
540553 app = appclass (0 )
541- app .MainLoop ()
554+ app .MainLoop ()
0 commit comments