rendered paste bodyimport wximport vdeskimport win32conclass App(wx.App): def OnInit(self): def CreateChildren(): self.Frame = ShapedFrame() def Configure(): Frame.Show() self.SetTopWindow(Frame) CreateChildren() Configure() return Trueclass ShapedFrame(wx.Frame): def __init__(self, Title, FrameShape): wx.Frame.__init__(self, None, -1, Title, (1,1), style = wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR) def CreateChildren(): def CreateBitmap(): bmp = wx.Image(FrameShape, wx.BITMAP_TYPE_PNG) bmp.ConvertAlphaToMask() return bmp.ConvertToBitmap() self.HasShape = False self.FrameShape = CreateBitmap() self.DC = wx.ClientDC(self) def Configure(): self.SetClientSize((self.FrameShape.GetWidth(), self.FrameShape.GetHeight())) self.dc.DrawBitmap(self.FrameShape, 0, 0, True) self.SetWindowShape() screenRect = wx.Display().GetGeometry() self.Move(((screenRect.GetWidth()/2)-(self.FrameShape.GetWidth()/2), (screenRect.GetHeight()/2)-(self.FrameShape()/2))) self.SetTransparent(220) def BindEvents(): #OnPaint Method/Event self.Bind(wx.EVT_PAINT, lambda self, evt: wx.PaintDC(self).DrawBitmap(self.FrameShape, 0, 0, True)) #SetWindowShape on Frame instantiation self.Bind(wx.EVT_WINDOW_CREATE, lambda self, event=None: self.SetShape(wx.RegionFromBitmap(self.FrameShape))) CreateChildren() Configure() BindEvents()class HashTagWindow(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "New Tag", (100, 100), style=wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.FRAME_TOOL_WINDOW) def CreateChildren(): self.HashTagInput = wx.TextCtrl(self, wx.NewId(), "", size=(200,-1)) self.HashTagAccept = wx.Button(self, -1, "Add Tag") def SetLayout(): sizer = wx.FlexGridSizer(cols=2) sizer.AddGrowableCol(0) #First col is the text control sizer.Add(self.HashTagInput, 0, wx.EXPAND) sizer.Add(self.HashTagAccept, 0, wx.EXPAND) self.SetSizer(sizer) self.Fit() def BindEvents(): self.HashTagInput.Bind(wx.EVT_KEY_UP, self.KeyPressEvent) CreateChildren() SetLayout() self.Center(wx.BOTH) def KeyPressEvent(self, event): keycode = event.GetKeyCode() if keycode == wx.WXK_ESCAPE: event.Skip() self.Close()class TaskBarIcon(wx.TaskBarIcon): def __init__(self, IconFilePath, ToolTip, Frame): wx.TaskBarIcon.__init__(self) self.SetIcon(wx.EmptyIcon(), "No tip") def CreateChildren(): self.IDMoveRight = wx.NewId() self.IDMoveLeft = wx.NewId() self.IDExit = wx.NewId() self.Icon = wx.EmptyIcon() self.Frame = Frame self.Menu = wx.Menu() def Configure(): def LoadBitmap(): image = wx.Image(IconFilePath, wx.BITMAP_TYPE_ANY) image.SetMaskColour(255, 0, 255) return wx.BitmapFromImage(image) self.Icon.CopyFromBitmap(LoadBitmap()) self.SetIcon(self.Icon, ToolTip) self.Menu.Append(self.IDMoveRight, "Move Desktop Right") self.Menu.Append(self.IDMoveLeft, "Move Desktop Left") self.Menu.AppendSeparator() self.Menu.Append(self.IDExit, "Exit") def BindEvents(): def LeftDoubleClickEvent(Event): if self.Frame.IsIconized(): self.Frame.Iconize(False) if not self.Frame.IsShown(): self.Frame.Show(True) self.Frame.Raise() self.Bind(wx.EVT_TASKBAR_LEFT_DCLICK, LeftDoubleClickEvent) self.Bind(wx.EVT_TASKBAR_RIGHT_UP, lambda Event: self.PopupMenu(self.Menu)) self.Bind(wx.EVT_MENU, self.Frame.OnExitEvent, id=self.IDExit) self.Bind(wx.EVT_MENU, self.Frame.MoveUserRightClickEvent, id=self.IDMoveRight) self.Bind(wx.EVT_MENU, self.Frame.MoveUserLeftClickEvent, id=self.IDMoveLeft) CreateChildren() Configure() BindEvents()class PreferencesWindow(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, -1, "DesktopManager", (100,100), (400,400), style=wx.CLOSE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.FRAME_TOOL_WINDOW) #Event ID's MoveUserRight = 1 MoveUserLeft = 2 MoveWindowRight = 3 MoveWindowLeft = 4 DebugWindow = 5 def CreateChildren(): self.TaskIcon = TaskBarIcon("Resources/icon.bmp", "Desktop Manager", self) def Configure(): def RegisterHotKeys(): self.RegisterHotKey(MoveUserRight, win32con.MOD_WIN | win32con.MOD_ALT, win32con.VK_RIGHT) self.RegisterHotKey(MoveUserLeft, win32con.MOD_WIN | win32con.MOD_ALT, win32con.VK_LEFT) self.RegisterHotKey(MoveWindowRight, win32con.MOD_WIN | win32con.MOD_CONTROL, win32con.VK_RIGHT) self.RegisterHotKey(MoveWindowLeft, win32con.MOD_WIN | win32con.MOD_CONTROL, win32con.VK_LEFT) self.RegisterHotKey(DebugWindow, 0, win32con.VK_F9) vdesk.InitDesktops(4) RegisterHotKeys() def BindEvents(): def BindHotKey(Functor, ID): self.Bind(wx.EVT_HOTKEY, Functor, id=ID) def DiagnosticEvent(Event): HTWindow = HashTagWindow() HTWindow.Show() HTWindow.Raise() BindHotKey(self.MoveUserRightClickEvent, MoveUserRight) BindHotKey(self.MoveUserLeftClickEvent, MoveUserLeft) BindHotKey(self.MoveWindowRightClickEvent, MoveWindowRight) BindHotKey(self.MoveWindowLeftClickEvent, MoveWindowLeft) BindHotKey(DiagnosticEvent, DebugWindow) self.Bind(wx.EVT_CLOSE, lambda Event: self.Hide()) CreateChildren() Configure() BindEvents() def OnExitEvent(self, Event): import sys self.TaskIcon.RemoveIcon() sys.exit(1) def MoveUserRightClickEvent(self, Event): vdesk.MoveUser(vdesk.Move.Right) def MoveUserLeftClickEvent(self, Event): vdesk.MoveUser(vdesk.Move.Left) def MoveWindowRightClickEvent(self, Event): vdesk.MoveWindow(vdesk.Move.Right) def MoveWindowLeftClickEvent(self, Event): vdesk.MoveWindow(vdesk.Move.Left) def DiagnosticEvent(self, Event): htwindow = HashTagWindow() htwindow.Show() htwindow.Raise()class AwesomeBar(wx.Frame): def __init__(self): screenRect = wx.Display().GetGeometry() wx.Frame.__init__(self, None, -1, "Desktop Awesome Bar", (0,0), (screenRect.GetWidth(), 25), style=wx.FRAME_SHAPED | wx.SIMPLE_BORDER | wx.FRAME_NO_TASKBAR) self.SetBackgroundColour("Black") self.SetTransparent(180)