Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

SetAlwaysOnTopAction

Allgemeines zum Thema EventGhost
Post Reply
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

SetAlwaysOnTopAction

Post by Bartman »

Ich habe noch eine kleine Action zum Festlegen des Always on Top Status geschrieben. K├Ânnte man in das Window Plugin aufnehmen.

Code: Select all

#-----------------------------------------------------------------------------


class SetAlwaysOnTop(eg.ActionClass):
    name = "Set always on top property"
    actions = ("Clear always on top", "Set always on top", "Toggle always on top")
    
    def __call__(self, action):
        hwnds = eg.lastFoundWindows
        if not hwnds:
            hwnds = [win32gui.GetForegroundWindow()]

        for hwnd in hwnds:
            if not win32gui.IsWindow(hwnd):
                eg.printError("Not A Window")
                continue
            isAlwaysOnTop = win32api.GetWindowLong(hwnd,
                win32con.GWL_EXSTYLE) & win32con.WS_EX_TOPMOST != 0
            if (isAlwaysOnTop == True) and (action == 0 or action == 2):
                win32gui.SetWindowPos(hwnd, win32con.HWND_NOTOPMOST,
                    0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)
            elif (isAlwaysOnTop == False) and (action == 1 or action == 2):
                win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST,
                    0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE)

    def GetLabel(self, action):
        return self.actions[action]
    
    def Configure(self, action = 2):
        dialog = eg.ConfigurationDialog(self)
        choices = len(self.actions)
        rb = range(0, choices)
        for i, text in enumerate(self.actions):
            rb[i] = wx.RadioButton(dialog, -1, text)
            rb[i].SetValue(action == i)
            dialog.sizer.Add(wx.Size(5,5))
            dialog.sizer.Add(rb[i], flag = wx.ALIGN_CENTER_VERTICAL)

        if dialog.AffirmedShowModal():
            for i in range(len(rb)):
                if rb[i].GetValue():
                    return (i, )
Bartman
Plugin Developer
Posts: 881
Joined: Sun Feb 12, 2006 9:03 am

Post by Bartman »

@Bitmonster
Die Action hattest du ├╝bernommen, wenn ich das richtig gesehen hatte?!

Ich wollte demnächst noch eine Action zum Setzen der Transparenz schreiben.
User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Post by Bitmonster »

Bartman wrote:@Bitmonster
Die Action hattest du ├╝bernommen, wenn ich das richtig gesehen hatte?!
Jepp, ist jetzt drin.
Post Reply