def OnCommand(self, hwnd, msg, wparam, lparam): FolderSelector_Parent.OnCommand(self, hwnd, msg, wparam, lparam) id = win32api.LOWORD(wparam) id_name = self._GetIDName(id) code = win32api.HIWORD(wparam) if code == win32con.BN_CLICKED: if id in (win32con.IDOK, win32con.IDCANCEL) and self.in_label_edit: cancel = id == win32con.IDCANCEL win32gui.SendMessage(self.list, commctrl.TVM_ENDEDITLABELNOW, cancel, 0) return # Button clicks if id == win32con.IDOK: if not self._CheckSelectionsValid(True): return self.selected_ids, self.checkbox_state = self.GetSelectedIDs() win32gui.EndDialog(hwnd, id) elif id == win32con.IDCANCEL: win32gui.EndDialog(hwnd, id) elif id_name == "IDC_BUT_CLEARALL": for info, spec in self._YieldCheckedChildren(): self.UnselectItem(info) elif id_name == "IDC_BUT_NEW": # Force a new entry in the tree at our location, and begin # editing. # Add the new item to the tree. h = win32gui.SendMessage(self.list, commctrl.TVM_GETNEXTITEM, commctrl.TVGN_CARET, commctrl.TVI_ROOT) parent_item = self._GetTVItem(h) if parent_item[6] == 0: # eeek - parent has no existig children - say we have one # so we can be expanded. update_item, extra = PackTVITEM(h, None, None, None, None, None, 1, None) win32gui.SendMessage(self.list, commctrl.TVM_SETITEM, 0, update_item) item_id = self._MakeItemParam(None) temp_spec = FolderSpec(None, "New folder") hnew = self._InsertFolder(h, temp_spec, None, commctrl.TVI_FIRST) win32gui.SendMessage(self.list, commctrl.TVM_ENSUREVISIBLE, 0, hnew) win32gui.SendMessage(self.list, commctrl.TVM_SELECTITEM, commctrl.TVGN_CARET, hnew) # Allow label editing s = win32api.GetWindowLong(self.list, win32con.GWL_STYLE) s |= commctrl.TVS_EDITLABELS win32api.SetWindowLong(self.list, win32con.GWL_STYLE, s) win32gui.SetFocus(self.list) self.in_label_edit = True win32gui.SendMessage(self.list, commctrl.TVM_EDITLABEL, 0, hnew) self._UpdateStatus()
def OnClicked(self, id): if id == self.control_id: if self.atFinish(): if not self.currentPage.SaveAllControls(): return #finish win32gui.EnableWindow(self.forward_btn_hwnd, False) win32gui.EnableWindow(self.back_btn_hwnd, False) try: #optional h = GetControl( self.window.manager.dialog_parser.ids["IDCANCEL"]) win32gui.EnableWindow(h, False) except: pass self.finish_fn(self.window.manager, self.window) win32gui.EndDialog(self.window.hwnd, win32con.IDOK) else: #forward if self.canGoNext() and self.currentPage.SaveAllControls(): self.page_stack.append(self.currentPageIndex) nextPage = self.getNextPageIndex() self.switchToPage(nextPage) elif id == self.back_btn_id: #backward assert self.page_stack, "Back should be disabled when no back stack" pageNo = self.page_stack.pop() print "Back button switching to page", pageNo self.switchToPage(pageNo)
def OnCommand(self, hwnd, msg, wparam, lparam): if wparam == win32con.IDCANCEL: self.selitem = None win32gui.EndDialog(hwnd, 0) elif wparam == win32con.IDOK or (win32api.LOWORD(wparam) == 1000 and win32api.HIWORD(wparam) == win32con.LBN_DBLCLK): listbox = win32gui.GetDlgItem(hwnd, 1000) sel = win32gui.SendMessage(listbox, win32con.LB_GETCURSEL, 0, 0) self.selitem = self.lst[sel] if 0 <= sel and sel < len( self.lst) else None if self.selitem is not None: win32gui.EndDialog(hwnd, 0) else: win32api.MessageBox(hwnd, '请从列表中选择一个项目', self.title, win32con.MB_ICONWARNING)
def OnClicked(self, id): problem = self.window.manager.GetDisabledReason() if problem: q = _("There appears to be a problem with SpamBayes' configuration" \ "\r\nIf you do not fix this problem, SpamBayes will be" \ " disabled.\r\n\r\n%s" \ "\r\n\r\nDo you wish to re-configure?") % (problem,) if self.window.manager.AskQuestion(q): return win32gui.EndDialog(self.window.hwnd, id)
def OnClose(self, hwnd, msg, wparam, lparam): if TooltipDialog.OnClose(self, hwnd, msg, wparam, lparam): return 1 if not self.SaveAllControls(): return 1 win32gui.EndDialog(hwnd, 0)
def __on_close(self, hwnd, msg, wparam, lparam): id = win32api.LOWORD(wparam) win32gui.EndDialog(hwnd, id) self.hwnd = None
def __on_command(self, hwnd, msg, wparam, lparam): id = win32api.LOWORD(wparam) if id in [win32con.IDOK]: win32gui.EndDialog(hwnd, id)
def EndDialog(self): win32gui.EndDialog(self.hwnd, 0)
def OnClose(self, hwnd, msg, wparam, lparam): win32gui.EndDialog(hwnd, 0)
def OnCommand(self, hwnd, msg, wparam, lparam): # Needed to make OK/Cancel work - no other controls are handled. id = win32api.LOWORD(wparam) if id in [win32con.IDOK, win32con.IDCANCEL]: win32gui.EndDialog(hwnd, id)
def OnClicked(self, id): getConnAttributes(self.window.manager) self.window.manager.SaveConfig() win32gui.EndDialog(self.window.hwnd, id)
except Exception,e: msg = getMessage(e) win32ui.MessageBox(msg, "Error", flag_excl) return setConnAttribs(server, port, self.mngr) if str(NewConn.getitem('_running')) == 'False': msg = "No server running on host '%s' at port '%d'. Press ignore to still continue with this configuration?"%(server,port) r=win32ui.MessageBox(msg, "Server Connection", win32con.MB_ABORTRETRYIGNORE | win32con.MB_ICONQUESTION) if r==3: resetConnAttribs(self.window) return elif r==4: self.OnClicked(id) elif r==5: setConnAttribs(server, port, self.mngr) win32gui.EndDialog(self.window.hwnd, id) class DoneButtonProcessor(ButtonProcessor): def OnClicked(self, id): getConnAttributes(self.window.manager) self.window.manager.SaveConfig() win32gui.EndDialog(self.window.hwnd, id) class MessageProcessor(ControlProcessor): def Init(self): text = "This Outlook Plugin for OpenERP has been developed by TinyERP \n\n \ For more information, please visit our website \n \ http://www.openerp.com \n\n \ Contact Us \n \ [email protected] \n\n \ 2001-TODAY Tiny sprl. All rights reserved. \n"
def OnClicked(self, id): a=self.func(self.window) win32gui.EndDialog(self.window.hwnd, id)
def OnClicked(self, id): win32gui.EndDialog(self.window.hwnd, id)