Пример #1
0
 def _set_item (self, item_id, value):
   ur"""Set the current value of an item in the dialog
   """
   item_hwnd = wrapped (win32gui.GetDlgItem, self.hwnd, item_id)
   class_name = wrapped (win32gui.GetClassName, item_hwnd)
   styles = wrapped (win32gui.GetWindowLong, self.hwnd, win32con.GWL_STYLE)
   if class_name == "Edit":
     if isinstance (value, datetime.date):
       value = value.strftime ("%d %b %Y")
     value = unicode (value).replace (u"\r\n", u"\n").replace (u"\n", u"\r\n")
     wrapped (win32gui.SetDlgItemText, self.hwnd, item_id, value)
   elif class_name == "Button":
     #~ if styles & win32con.BS_CHECKBOX:
     SendMessage (item_hwnd, win32con.BM_SETCHECK, int (value), 0)
     #~ elif styles & win32con.BS_RADIOBUTTON:
   elif class_name == "ComboBox":
     for item in value:
       if isinstance (item, tuple):
         item = item[0]
       SendMessage (item_hwnd, win32con.CB_ADDSTRING, 0, utils.string_as_pointer (str (item)))
     SendMessage (item_hwnd, win32con.CB_SETCURSEL, 0, 0)
   elif class_name == "Static":
     wrapped (win32gui.SetDlgItemText, self.hwnd, item_id, unicode (value))
   else:
     raise RuntimeError ("Unknown class: %s" % class_name)
Пример #2
0
 def _set_item(self, item_id, value):
     """Set the current value of an item in the dialog
     """
     item_hwnd = wrapped(win32gui.GetDlgItem, self.hwnd, item_id)
     class_name = wrapped(win32gui.GetClassName, item_hwnd)
     styles = wrapped(win32gui.GetWindowLong, self.hwnd, win32con.GWL_STYLE)
     if class_name == "Edit":
         if isinstance(value, datetime.date):
             value = value.strftime("%d %b %Y")
         value = unicode(value).replace("\r\n", "\n").replace("\n", "\r\n")
         wrapped(win32gui.SetDlgItemText, self.hwnd, item_id, value)
     elif class_name == "Button":
         #~ if styles & win32con.BS_CHECKBOX:
         SendMessage(item_hwnd, win32con.BM_SETCHECK, int(value), 0)
         #~ elif styles & win32con.BS_RADIOBUTTON:
     elif class_name == "ComboBox":
         for item in value:
             if isinstance(item, tuple):
                 item = item[0]
             SendMessage(item_hwnd, win32con.CB_ADDSTRING, 0,
                         utils.string_as_pointer(str(item)))
         SendMessage(item_hwnd, win32con.CB_SETCURSEL, 0, 0)
     elif class_name == "Static":
         wrapped(win32gui.SetDlgItemText, self.hwnd, item_id,
                 unicode(value))
     else:
         raise RuntimeError("Unknown class: %s" % class_name)
Пример #3
0
 def Drop (self, data_object, key_state, point, effect):
   child_point = wrapped (win32gui.ScreenToClient, self.hwnd, point)
   child_hwnd = wrapped (win32gui.ChildWindowFromPoint, self.hwnd, child_point)
   data = data_object.GetData (self._data_format)
   n_files = shell.DragQueryFileW (data.data_handle, -1)
   if n_files:
     SendMessage (
       child_hwnd, win32con.WM_SETTEXT, None,
       utils.string_as_pointer (shell.DragQueryFileW (data.data_handle, 0).encode (ENCODING))
     )
Пример #4
0
 def Drop (self, data_object, key_state, point, effect):
   child_point = wrapped (win32gui.ScreenToClient, self.hwnd, point)
   child_hwnd = wrapped (win32gui.ChildWindowFromPoint, self.hwnd, child_point)
   data = data_object.GetData (self._data_format)
   n_files = shell.DragQueryFileW (data.data_handle, -1)
   if n_files:
     SendMessage (
       child_hwnd, win32con.WM_SETTEXT, None,
       utils.string_as_pointer (shell.DragQueryFileW (data.data_handle, 0).encode (ENCODING))
     )
Пример #5
0
 def _set_start_folder (hwnd, msg, lp, data):
   if msg == BFFM.INITIALIZED and data:
     SendMessage (hwnd, BFFM.SETSELECTION, 1, utils.string_as_pointer (data))
Пример #6
0
 def _set_start_folder(hwnd, msg, lp, data):
     if msg == BFFM.INITIALIZED and data:
         SendMessage(hwnd, BFFM.SETSELECTION, 1,
                     utils.string_as_pointer(data))