Mercurial > libervia-web
comparison browser_side/base_widget.py @ 396:a71fcc27f231
browser_side: small improvements for ListManager
author | souliane <souliane@mailoo.org> |
---|---|
date | Tue, 11 Mar 2014 10:45:52 +0100 |
parents | 30d03d9f07e4 |
children | 8ecc5a7062e4 |
comparison
equal
deleted
inserted
replaced
395:98cd5387d291 | 396:a71fcc27f231 |
---|---|
105 cell = grid.getEventTargetCell(event) | 105 cell = grid.getEventTargetCell(event) |
106 row = DOM.getParent(cell) | 106 row = DOM.getParent(cell) |
107 return (row.rowIndex, cell.cellIndex) | 107 return (row.rowIndex, cell.cellIndex) |
108 | 108 |
109 def onDrop(self, event): | 109 def onDrop(self, event): |
110 self.removeStyleName('dragover') | |
110 DOM.eventPreventDefault(event) | 111 DOM.eventPreventDefault(event) |
111 dt = event.dataTransfer | 112 dt = event.dataTransfer |
112 # 'text', 'text/plain', and 'Text' are equivalent. | 113 # 'text', 'text/plain', and 'Text' are equivalent. |
113 try: | 114 try: |
114 item, item_type = dt.getData("text/plain").split('\n') # Workaround for webkit, only text/plain seems to be managed | 115 item, item_type = dt.getData("text/plain").split('\n') # Workaround for webkit, only text/plain seems to be managed |
133 wid_row = widgets_panel.getWidgetCoords(_new_panel)[0] | 134 wid_row = widgets_panel.getWidgetCoords(_new_panel)[0] |
134 row_wids = widgets_panel.getLiberviaRowWidgets(wid_row) | 135 row_wids = widgets_panel.getLiberviaRowWidgets(wid_row) |
135 if len(row_wids) == 1 and wid_row == widgets_panel.getWidgetCoords(self)[0]: | 136 if len(row_wids) == 1 and wid_row == widgets_panel.getWidgetCoords(self)[0]: |
136 # the dropped widget is the only one in the same row | 137 # the dropped widget is the only one in the same row |
137 # as the target widget (self), we don't do anything | 138 # as the target widget (self), we don't do anything |
138 self.removeStyleName('dragover') | |
139 return | 139 return |
140 widgets_panel.removeWidget(_new_panel) | 140 widgets_panel.removeWidget(_new_panel) |
141 elif item_type in self.drop_keys: | 141 elif item_type in self.drop_keys: |
142 _new_panel = self.drop_keys[item_type](self.host, item) | 142 _new_panel = self.drop_keys[item_type](self.host, item) |
143 elif item_type == "CONTACT_TEXTBOX": | |
144 # eventually open a window? | |
145 pass | |
146 else: | 143 else: |
147 print "WARNING: unmanaged item type" | 144 print "WARNING: unmanaged item type" |
148 return | 145 return |
149 if isinstance(self, LiberviaWidget): | 146 if isinstance(self, LiberviaWidget): |
150 self.host.unregisterWidget(self) | 147 self.host.unregisterWidget(self) |
675 return | 672 return |
676 _new_panel = LiberviaDragWidget.current | 673 _new_panel = LiberviaDragWidget.current |
677 _new_panel.getWidgetsPanel().removeWidget(_new_panel) | 674 _new_panel.getWidgetsPanel().removeWidget(_new_panel) |
678 elif item_type in DropCell.drop_keys: | 675 elif item_type in DropCell.drop_keys: |
679 _new_panel = DropCell.drop_keys[item_type](self.tab_panel.host, item) | 676 _new_panel = DropCell.drop_keys[item_type](self.tab_panel.host, item) |
680 elif item_type == "CONTACT_TEXTBOX": | |
681 # eventually open a window? | |
682 pass | |
683 else: | 677 else: |
684 print "WARNING: unmanaged item type" | 678 print "WARNING: unmanaged item type" |
685 return | 679 return |
686 | 680 |
687 widgets_panel = self.tab_panel.getWidget(self._getIndex()) | 681 widgets_panel = self.tab_panel.getWidget(self._getIndex()) |