xpra icon
Bug tracker and wiki

Ticket #678: platform-win32.diff

File platform-win32.diff, 10.0 KB (added by Antoine Martin, 3 years ago)

temporary patching for build with mingw, without any pywin32 modules

  • xpra/platform/win32/__init__.py

     
    1010import os.path
    1111import sys
    1212
    13 import win32con         #@UnresolvedImport
    14 import win32api         #@UnresolvedImport
    15 import win32console     #@UnresolvedImport
     13from xpra.platform.win32 import constants
     14try:
     15    import win32api         #@UnresolvedImport
     16except:
     17     pass
    1618
    1719#redirect output if we are launched from py2exe's gui mode:
    1820frozen = getattr(sys, 'frozen', False)
     
    3638
    3739def is_wine():
    3840    try:
    39         hKey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, r"Software\\Wine")
     41        hKey = win32api.RegOpenKey(constants.HKEY_LOCAL_MACHINE, r"Software\\Wine")
    4042        return hKey is not None
    4143    except:
    4244        #no wine key, assume not present and wait for input
     
    219221        _wait_for_input = False
    220222        return
    221223    try:
     224        #import win32console
    222225        handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE)
    223226        #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE)
    224227        console_info = handle.GetConsoleScreenBufferInfo()
     
    238241            #we could also re-use the code above from "not_a_console()"
    239242            pass
    240243        else:
    241             print("error accessing console %s: %s" % (errno.errorcode.get(e.errno, e.errno), e))
     244            try:
     245                print("error accessing console %s: %s" % (errno.errorcode.get(e.errno, e.errno), e))
     246            except:
     247                print("error accessing console: %s" % e)
    242248
    243 
    244249def do_init():
    245250    if not REDIRECT_OUTPUT:
    246251        if sys.version_info[0]<3:
     
    259264
    260265
    261266CONSOLE_EXIT_EVENTS = []
    262 CONSOLE_EXIT_EVENTS = [win32con.CTRL_C_EVENT,
    263                        win32con.CTRL_LOGOFF_EVENT,
    264                        win32con.CTRL_BREAK_EVENT,
    265                        win32con.CTRL_SHUTDOWN_EVENT,
    266                        win32con.CTRL_CLOSE_EVENT]
     267CONSOLE_EXIT_EVENTS = [constants.CTRL_C_EVENT,
     268                       constants.CTRL_LOGOFF_EVENT,
     269                       constants.CTRL_BREAK_EVENT,
     270                       constants.CTRL_SHUTDOWN_EVENT,
     271                       constants.CTRL_CLOSE_EVENT]
    267272class console_event_catcher(object):
    268273    def __init__(self, event_cb, events=CONSOLE_EXIT_EVENTS):
    269274        self.event_cb = event_cb
  • xpra/platform/win32/gui.py

     
    1717
    1818from xpra.platform.win32.win32_events import get_win32_event_listener
    1919from xpra.platform.win32.window_hooks import Win32Hooks
     20from xpra.platform.win32 import constants as win32con
    2021from xpra.util import AdHocStruct, csv, envint, envbool
    2122import ctypes
    2223from ctypes import CFUNCTYPE, c_int, POINTER, Structure, windll, byref, sizeof
    2324from ctypes.wintypes import HWND, DWORD, WPARAM, LPARAM
    2425
    25 import win32con     #@UnresolvedImport
    26 import win32api     #@UnresolvedImport
    27 import win32gui     #@UnresolvedImport
    28 
    2926WINDOW_HOOKS = envbool("XPRA_WIN32_WINDOW_HOOKS", True)
    3027GROUP_LEADER = WINDOW_HOOKS and envbool("XPRA_WIN32_GROUP_LEADER", True)
    3128UNDECORATED_STYLE = WINDOW_HOOKS and envbool("XPRA_WIN32_UNDECORATED_STYLE", True)
  • xpra/platform/win32/info.py

     
    33# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    44# later version. See the file COPYING for details.
    55
    6 import win32api        #@UnresolvedImport
    76
    87def get_sys_info():
    98    return  {}
  • xpra/platform/win32/keyboard.py

     
    44# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    55# later version. See the file COPYING for details.
    66
    7 import win32api         #@UnresolvedImport
    8 import win32con         #@UnresolvedImport
    9 import win32gui         #@UnresolvedImport
    107
    118from xpra.platform.keyboard_base import KeyboardBase
    129from xpra.keyboard.layouts import WIN32_LAYOUTS
  • xpra/platform/win32/keyboard_config.py

     
    77from xpra.log import Logger
    88log = Logger("keyboard", "win32")
    99
    10 import win32con         #@UnresolvedImport
    11 import win32api         #@UnresolvedImport
    1210from xpra.server.keyboard_config_base import KeyboardConfigBase
    1311
    1412
  • xpra/platform/win32/paths.py

     
    77import os.path
    88import sys
    99
    10 import win32api             #@UnresolvedImport
    11 import win32con             #@UnresolvedImport
    1210
    13 
    1411def _get_data_dir():
    1512    #if not running from a binary, return current directory:
    1613    if not getattr(sys, 'frozen', ''):
     
    6966
    7067
    7168def get_registry_value(key, reg_path, entry):
     69    import win32api             #@UnresolvedImport
    7270    hKey = win32api.RegOpenKey(key, reg_path)
    7371    value, _ = win32api.RegQueryValueEx(hKey, entry)
    7472    win32api.RegCloseKey(hKey)
     
    8482    try:
    8583        #use the internet explorer registry key:
    8684        #HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer
     85        import win32con             #@UnresolvedImport
    8786        DOWNLOAD_PATH = get_registry_value(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer", "Download Directory")
    8887    except:
    8988        #fallback to what the documentation says is the default:
  • xpra/platform/win32/printing.py

     
    88
    99import os.path
    1010import subprocess
    11 import win32print       #@UnresolvedImport
    12 import win32con         #@UnresolvedImport
    1311
    1412from xpra.util import csv, envint
    1513
  • xpra/platform/win32/shadow_server.py

     
    66
    77import os
    88import time
    9 import win32api         #@UnresolvedImport
    10 import win32con         #@UnresolvedImport
    11 import win32ui          #@UnresolvedImport
    12 import win32gui         #@UnresolvedImport
    13 import win32process     #@UnresolvedImport
    149import pywintypes       #@UnresolvedImport
    1510
    1611from xpra.log import Logger
  • xpra/platform/win32/webcam.py

     
    88
    99
    1010try:
    11     from win32con import WM_DEVICECHANGE
    1211    from xpra.platform.win32.win32_events import get_win32_event_listener
    1312except ImportError as e:
    1413    WM_DEVICECHANGE = 7
  • xpra/platform/win32/win32_NotifyIcon.py

     
    77# Low level support for the "system tray" on MS Windows
    88# Based on code from winswitch, itself based on "win32gui_taskbar demo"
    99
    10 import win32api                    #@UnresolvedImport
    11 import win32gui                    #@UnresolvedImport
    12 import win32con                    #@UnresolvedImport
    1310
    1411import sys, os
    1512
  • xpra/platform/win32/win32_balloon.py

     
    1111from ctypes import windll
    1212
    1313# Try and use XP features, so we get alpha-blending etc.
    14 try:
    15     from winxpgui import NIF_INFO, NIIF_INFO, NIM_MODIFY
    16 except ImportError:
    17     from win32gui import NIF_INFO, NIIF_INFO, NIM_MODIFY
    1814import struct
    1915
    2016
  • xpra/platform/win32/win32_events.py

     
    44# Xpra is released under the terms of the GNU GPL v2, or, at your option, any
    55# later version. See the file COPYING for details.
    66
    7 import win32ts          #@UnresolvedImport
    8 import win32con         #@UnresolvedImport
    9 import win32api         #@UnresolvedImport
    10 import win32gui         #@UnresolvedImport
    117
    128from xpra.log import Logger
    139log = Logger("events", "win32")
    1410
    1511from xpra.platform.win32.wndproc_events import WNDPROC_EVENT_NAMES
     12from xpra.platform.win32 import constants as win32con
    1613
    1714#no idea where we're supposed to get those from:
    1815WM_WTSSESSION_CHANGE        = 0x02b1
  • xpra/platform/win32/win32_tray.py

     
    77# Augments the win32_NotifyIcon "system tray" support class
    88# with methods for integrating with win32_balloon and the popup menu
    99
    10 import win32con         #@UnresolvedImport
    11 import win32api         #@UnresolvedImport
    1210
    1311from xpra.log import Logger
    1412log = Logger("tray", "win32")
  • xpra/platform/win32/window_hooks.py

     
    1010log = Logger("win32", "window", "util")
    1111vlog = Logger("verbose")
    1212
    13 import win32con         #@UnresolvedImport
    14 import win32api         #@UnresolvedImport
    1513import ctypes
    1614from ctypes import c_int, c_long
    1715from ctypes.wintypes import POINT