Python win32con.SW_SHOW Examples

The following are 9 code examples of win32con.SW_SHOW(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module win32con , or try the search function .
Example #1
Source File: debugger.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def GUIAboutToInteract(self):
		"Called as the GUI is about to perform any interaction with the user"
		frame = win32ui.GetMainFrame()
		# Remember the enabled state of our main frame
		# may be disabled primarily if a modal dialog is displayed.
		# Only get at enabled via GetWindowLong.
		self.bFrameEnabled = frame.IsWindowEnabled()
		self.oldForeground = None
		fw = win32ui.GetForegroundWindow()
		if fw is not frame:
			self.oldForeground = fw
#			fw.EnableWindow(0) Leave enabled for now?
			self.oldFrameEnableState = frame.IsWindowEnabled()
			frame.EnableWindow(1)
		if self.inForcedGUI and not frame.IsWindowVisible():
			frame.ShowWindow(win32con.SW_SHOW)
			frame.UpdateWindow()
		if self.curframe:
			SetInteractiveContext(self.curframe.f_globals, self.curframe.f_locals)
		else:
			SetInteractiveContext(None, None)
		self.GUIRespondDebuggerData() 
Example #2
Source File: document.py    From ironpython2 with Apache License 2.0 6 votes vote down vote up
def _UpdateUIForState(self):
		"""Change the title to reflect the state of the document - 
		eg ReadOnly, Dirty, etc
		"""
		filename = self.GetPathName()
		if not filename: return # New file - nothing to do
		try:
			# This seems necessary so the internal state of the window becomes
			# "visible".  without it, it is still shown, but certain functions
			# (such as updating the title) dont immediately work?
			self.GetFirstView().ShowWindow(win32con.SW_SHOW)
			title = win32ui.GetFileTitle(filename)
		except win32ui.error:
			title = filename
		if self._IsReadOnly():
			title = title + " (read-only)"
		self.SetTitle(title) 
Example #3
Source File: regedit.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def EditValue(self, item):
		# Edit the current value
		class EditDialog(dialog.Dialog):
			def __init__(self, item):
				self.item = item
				dialog.Dialog.__init__(self, win32ui.IDD_LARGE_EDIT)
			def OnInitDialog(self):
				self.SetWindowText("Enter new value")
				self.GetDlgItem(win32con.IDCANCEL).ShowWindow(win32con.SW_SHOW)
				self.edit = self.GetDlgItem(win32ui.IDC_EDIT1)
				# Modify the edit windows style
				style = win32api.GetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE)
				style = style & (~win32con.ES_WANTRETURN)
				win32api.SetWindowLong(self.edit.GetSafeHwnd(), win32con.GWL_STYLE, style)
				self.edit.SetWindowText(str(self.item))
				self.edit.SetSel(-1)
				return dialog.Dialog.OnInitDialog(self)
			def OnDestroy(self,msg):
				self.newvalue = self.edit.GetWindowText()
		
		try:
			index = self.GetNextItem(-1, commctrl.LVNI_SELECTED)
		except win32ui.error:
			return # No item selected.

		if index==0:
			keyVal = ""
		else:
			keyVal = self.GetItemText(index,0)
		# Query for a new value.
		try:
			newVal = self.GetItemsCurrentValue(item, keyVal)
		except TypeError, details:
			win32ui.MessageBox(details)
			return 
Example #4
Source File: help.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def OpenHelpFile(fileName, helpCmd = None, helpArg = None):
	"Open a help file, given a full path"
	# default help arg.
	win32ui.DoWaitCursor(1)
	try:
		if helpCmd is None: helpCmd = win32con.HELP_CONTENTS
		ext = os.path.splitext(fileName)[1].lower()
		if ext == ".hlp":
			win32api.WinHelp( win32ui.GetMainFrame().GetSafeHwnd(), fileName, helpCmd, helpArg)
		# XXX - using the htmlhelp API wreaks havoc with keyboard shortcuts
		# so we disable it, forcing ShellExecute, which works fine (but
		# doesn't close the help file when Pythonwin is closed.
		# Tom Heller also points out http://www.microsoft.com/mind/0499/faq/faq0499.asp,
		# which may or may not be related.
		elif 0 and ext == ".chm":
			import win32help
			global htmlhelp_handle
			helpCmd = html_help_command_translators.get(helpCmd, helpCmd)
			#frame = win32ui.GetMainFrame().GetSafeHwnd()
			frame = 0 # Dont want it overlapping ours!
			if htmlhelp_handle is None:
				htmlhelp_hwnd, htmlhelp_handle = win32help.HtmlHelp(frame, None, win32help.HH_INITIALIZE)
			win32help.HtmlHelp(frame, fileName, helpCmd, helpArg)
		else:
			# Hope that the extension is registered, and we know what to do!
			win32api.ShellExecute(0, "open", fileName, None, "", win32con.SW_SHOW)
		return fileName
	finally:
		win32ui.DoWaitCursor(-1) 
Example #5
Source File: ietoolbar.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def ShowDW(self, bShow):
        if bShow:
            self.toolbar.ShowWindow(win32con.SW_SHOW)
        else:
            self.toolbar.ShowWindow(win32con.SW_HIDE) 
Example #6
Source File: dependency.py    From kano-burners with GNU General Public License v2.0 5 votes vote down vote up
def request_admin_privileges():
    ASADMIN = 'asadmin'

    if sys.argv[-1] != ASADMIN:
        script = os.path.abspath(sys.argv[0])
        params = ' '.join([script] + sys.argv[1:] + [ASADMIN])
        shell.ShellExecuteEx(lpVerb='runas', lpFile=sys.executable,
                             lpParameters=params, nShow=win32con.SW_SHOW)
        sys.exit(0) 
Example #7
Source File: main.py    From MouseTracks with GNU General Public License v3.0 5 votes vote down vote up
def hide(self, new=True):
        """Hide a window from the task bar.
        Kept the old way just to be on the safe side.
        """
        if new:
            win32gui.ShowWindow(self.hwnd, False)
        else:
            self.minimise()
            win32gui.ShowWindow(self.hwnd, win32con.SW_HIDE)
            win32gui.SetWindowLong(self.hwnd, win32con.GWL_EXSTYLE,
                                   win32gui.GetWindowLong(self.hwnd, win32con.GWL_EXSTYLE) | win32con.WS_EX_TOOLWINDOW)
            win32gui.ShowWindow(self.hwnd, win32con.SW_SHOW) 
Example #8
Source File: EmbedWindow.py    From PyQt with GNU General Public License v3.0 5 votes vote down vote up
def restore(self):
        """归还窗口"""
        # 有bug,归还后窗口没有了WS_VISIBLE样式,不可见
        widget = self.layout().itemAt(3).widget()
        print('restore', widget.hwnd, widget.style, widget.exstyle)
        win32gui.SetParent(widget.hwnd, widget.phwnd)  # 让它返回它的父窗口
        win32gui.SetWindowLong(
            widget.hwnd, win32con.GWL_STYLE, widget.style | win32con.WS_VISIBLE)  # 恢复样式
        win32gui.SetWindowLong(
            widget.hwnd, win32con.GWL_EXSTYLE, widget.exstyle)  # 恢复样式
        win32gui.ShowWindow(
            widget.hwnd, win32con.SW_SHOW)  # 显示窗口
        widget.close()
        self.layout().removeWidget(widget)  # 从布局中移出
        widget.deleteLater() 
Example #9
Source File: winapi.py    From gui-o-matic with GNU Lesser General Public License v3.0 5 votes vote down vote up
def set_visibility( self, visibility  ):
        state = win32con.SW_SHOW if visibility else win32con.SW_HIDE
        win32gui.ShowWindow( self.window_handle, state )
        win32gui.UpdateWindow( self.window_handle )