Ticket #678: platform-win32.diff
File platform-win32.diff, 10.0 KB (added by , 4 years ago) |
---|
-
xpra/platform/win32/__init__.py
10 10 import os.path 11 11 import sys 12 12 13 import win32con #@UnresolvedImport 14 import win32api #@UnresolvedImport 15 import win32console #@UnresolvedImport 13 from xpra.platform.win32 import constants 14 try: 15 import win32api #@UnresolvedImport 16 except: 17 pass 16 18 17 19 #redirect output if we are launched from py2exe's gui mode: 18 20 frozen = getattr(sys, 'frozen', False) … … 36 38 37 39 def is_wine(): 38 40 try: 39 hKey = win32api.RegOpenKey( win32con.HKEY_LOCAL_MACHINE, r"Software\\Wine")41 hKey = win32api.RegOpenKey(constants.HKEY_LOCAL_MACHINE, r"Software\\Wine") 40 42 return hKey is not None 41 43 except: 42 44 #no wine key, assume not present and wait for input … … 219 221 _wait_for_input = False 220 222 return 221 223 try: 224 #import win32console 222 225 handle = win32console.GetStdHandle(win32console.STD_OUTPUT_HANDLE) 223 226 #handle.SetConsoleTextAttribute(win32console.FOREGROUND_BLUE) 224 227 console_info = handle.GetConsoleScreenBufferInfo() … … 238 241 #we could also re-use the code above from "not_a_console()" 239 242 pass 240 243 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) 242 248 243 244 249 def do_init(): 245 250 if not REDIRECT_OUTPUT: 246 251 if sys.version_info[0]<3: … … 259 264 260 265 261 266 CONSOLE_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]267 CONSOLE_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] 267 272 class console_event_catcher(object): 268 273 def __init__(self, event_cb, events=CONSOLE_EXIT_EVENTS): 269 274 self.event_cb = event_cb -
xpra/platform/win32/gui.py
17 17 18 18 from xpra.platform.win32.win32_events import get_win32_event_listener 19 19 from xpra.platform.win32.window_hooks import Win32Hooks 20 from xpra.platform.win32 import constants as win32con 20 21 from xpra.util import AdHocStruct, csv, envint, envbool 21 22 import ctypes 22 23 from ctypes import CFUNCTYPE, c_int, POINTER, Structure, windll, byref, sizeof 23 24 from ctypes.wintypes import HWND, DWORD, WPARAM, LPARAM 24 25 25 import win32con #@UnresolvedImport26 import win32api #@UnresolvedImport27 import win32gui #@UnresolvedImport28 29 26 WINDOW_HOOKS = envbool("XPRA_WIN32_WINDOW_HOOKS", True) 30 27 GROUP_LEADER = WINDOW_HOOKS and envbool("XPRA_WIN32_GROUP_LEADER", True) 31 28 UNDECORATED_STYLE = WINDOW_HOOKS and envbool("XPRA_WIN32_UNDECORATED_STYLE", True) -
xpra/platform/win32/info.py
3 3 # Xpra is released under the terms of the GNU GPL v2, or, at your option, any 4 4 # later version. See the file COPYING for details. 5 5 6 import win32api #@UnresolvedImport7 6 8 7 def get_sys_info(): 9 8 return {} -
xpra/platform/win32/keyboard.py
4 4 # Xpra is released under the terms of the GNU GPL v2, or, at your option, any 5 5 # later version. See the file COPYING for details. 6 6 7 import win32api #@UnresolvedImport8 import win32con #@UnresolvedImport9 import win32gui #@UnresolvedImport10 7 11 8 from xpra.platform.keyboard_base import KeyboardBase 12 9 from xpra.keyboard.layouts import WIN32_LAYOUTS -
xpra/platform/win32/keyboard_config.py
7 7 from xpra.log import Logger 8 8 log = Logger("keyboard", "win32") 9 9 10 import win32con #@UnresolvedImport11 import win32api #@UnresolvedImport12 10 from xpra.server.keyboard_config_base import KeyboardConfigBase 13 11 14 12 -
xpra/platform/win32/paths.py
7 7 import os.path 8 8 import sys 9 9 10 import win32api #@UnresolvedImport11 import win32con #@UnresolvedImport12 10 13 14 11 def _get_data_dir(): 15 12 #if not running from a binary, return current directory: 16 13 if not getattr(sys, 'frozen', ''): … … 69 66 70 67 71 68 def get_registry_value(key, reg_path, entry): 69 import win32api #@UnresolvedImport 72 70 hKey = win32api.RegOpenKey(key, reg_path) 73 71 value, _ = win32api.RegQueryValueEx(hKey, entry) 74 72 win32api.RegCloseKey(hKey) … … 84 82 try: 85 83 #use the internet explorer registry key: 86 84 #HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer 85 import win32con #@UnresolvedImport 87 86 DOWNLOAD_PATH = get_registry_value(win32con.HKEY_CURRENT_USER, "Software\\Microsoft\\Internet Explorer", "Download Directory") 88 87 except: 89 88 #fallback to what the documentation says is the default: -
xpra/platform/win32/printing.py
8 8 9 9 import os.path 10 10 import subprocess 11 import win32print #@UnresolvedImport12 import win32con #@UnresolvedImport13 11 14 12 from xpra.util import csv, envint 15 13 -
xpra/platform/win32/shadow_server.py
6 6 7 7 import os 8 8 import time 9 import win32api #@UnresolvedImport10 import win32con #@UnresolvedImport11 import win32ui #@UnresolvedImport12 import win32gui #@UnresolvedImport13 import win32process #@UnresolvedImport14 9 import pywintypes #@UnresolvedImport 15 10 16 11 from xpra.log import Logger -
xpra/platform/win32/webcam.py
8 8 9 9 10 10 try: 11 from win32con import WM_DEVICECHANGE12 11 from xpra.platform.win32.win32_events import get_win32_event_listener 13 12 except ImportError as e: 14 13 WM_DEVICECHANGE = 7 -
xpra/platform/win32/win32_NotifyIcon.py
7 7 # Low level support for the "system tray" on MS Windows 8 8 # Based on code from winswitch, itself based on "win32gui_taskbar demo" 9 9 10 import win32api #@UnresolvedImport11 import win32gui #@UnresolvedImport12 import win32con #@UnresolvedImport13 10 14 11 import sys, os 15 12 -
xpra/platform/win32/win32_balloon.py
11 11 from ctypes import windll 12 12 13 13 # Try and use XP features, so we get alpha-blending etc. 14 try:15 from winxpgui import NIF_INFO, NIIF_INFO, NIM_MODIFY16 except ImportError:17 from win32gui import NIF_INFO, NIIF_INFO, NIM_MODIFY18 14 import struct 19 15 20 16 -
xpra/platform/win32/win32_events.py
4 4 # Xpra is released under the terms of the GNU GPL v2, or, at your option, any 5 5 # later version. See the file COPYING for details. 6 6 7 import win32ts #@UnresolvedImport8 import win32con #@UnresolvedImport9 import win32api #@UnresolvedImport10 import win32gui #@UnresolvedImport11 7 12 8 from xpra.log import Logger 13 9 log = Logger("events", "win32") 14 10 15 11 from xpra.platform.win32.wndproc_events import WNDPROC_EVENT_NAMES 12 from xpra.platform.win32 import constants as win32con 16 13 17 14 #no idea where we're supposed to get those from: 18 15 WM_WTSSESSION_CHANGE = 0x02b1 -
xpra/platform/win32/win32_tray.py
7 7 # Augments the win32_NotifyIcon "system tray" support class 8 8 # with methods for integrating with win32_balloon and the popup menu 9 9 10 import win32con #@UnresolvedImport11 import win32api #@UnresolvedImport12 10 13 11 from xpra.log import Logger 14 12 log = Logger("tray", "win32") -
xpra/platform/win32/window_hooks.py
10 10 log = Logger("win32", "window", "util") 11 11 vlog = Logger("verbose") 12 12 13 import win32con #@UnresolvedImport14 import win32api #@UnresolvedImport15 13 import ctypes 16 14 from ctypes import c_int, c_long 17 15 from ctypes.wintypes import POINT