Mercurial > libervia-web
comparison browser_side/panels.py @ 90:9729ed7171a6
browser side: Widgets' setting (col & row span can be changed
author | Goffi <goffi@goffi.org> |
---|---|
date | Tue, 28 Jun 2011 01:54:36 +0200 |
parents | 8d2c7be09eef |
children | dd54bc13ac81 |
comparison
equal
deleted
inserted
replaced
89:8d2c7be09eef | 90:9729ed7171a6 |
---|---|
165 self.setSize('100%', '100%') | 165 self.setSize('100%', '100%') |
166 self.addStyleName('widget') | 166 self.addStyleName('widget') |
167 if self.__selectable: | 167 if self.__selectable: |
168 self.addClickListener(self) | 168 self.addClickListener(self) |
169 self.host.registerWidget(self) | 169 self.host.registerWidget(self) |
170 | |
171 def _getWidgetsPanel(self): | |
172 return self.getParent().getParent().getParent() | |
170 | 173 |
171 def onClick(self, sender): | 174 def onClick(self, sender): |
172 self.host.select(self) | 175 self.host.select(self) |
173 | 176 |
174 def onClose(self, sender): | 177 def onClose(self, sender): |
175 print "onClose:", sender | 178 print "onClose:", sender |
176 _widgetspanel = self.getParent().getParent().getParent() | 179 _widgetspanel = self._getWidgetsPanel() |
177 _widgetspanel.removeWidget(self) | 180 _widgetspanel.removeWidget(self) |
178 | 181 |
179 def onSetting(self, sender): | 182 def onSetting(self, sender): |
180 Window.alert('settings') | 183 widpanel = self._getWidgetsPanel() |
184 row, col = widpanel.getIndex(self) | |
185 body = VerticalPanel() | |
186 colspan = widpanel.getColSpan(row, col) | |
187 rowspan = widpanel.getRowSpan(row, col) | |
188 def onColSpanChange(value): | |
189 widpanel.setColSpan(row, col, value) | |
190 def onRowSpanChange(value): | |
191 widpanel.setRowSpan(row, col, value) | |
192 colspan_setter = dialog.IntSetter("Columns span", colspan) | |
193 colspan_setter.addValueChangeListener(onColSpanChange) | |
194 colspan_setter.setWidth('100%') | |
195 rowspan_setter = dialog.IntSetter("Rows span", rowspan) | |
196 rowspan_setter.addValueChangeListener(onRowSpanChange) | |
197 rowspan_setter.setWidth('100%') | |
198 body.add(colspan_setter) | |
199 body.add(rowspan_setter) | |
200 _dialog = dialog.GenericDialog("Widget setting", body) | |
201 _dialog.show() | |
181 | 202 |
182 def setTitle(self, text): | 203 def setTitle(self, text): |
183 """change the title in the header of the widget | 204 """change the title in the header of the widget |
184 @param text: text of the new title""" | 205 @param text: text of the new title""" |
185 self.__title.setText(text) | 206 self.__title.setText(text) |
748 _max_cols = max(_max_cols, self.flextable.getCellCount(row_idx)) | 769 _max_cols = max(_max_cols, self.flextable.getCellCount(row_idx)) |
749 if _max_cols != self._max_cols: | 770 if _max_cols != self._max_cols: |
750 self._max_cols = _max_cols | 771 self._max_cols = _max_cols |
751 self._sizesAdjust() | 772 self._sizesAdjust() |
752 | 773 |
774 def getIndex(self, wid): | |
775 return self.flextable.getIndex(wid) | |
776 | |
777 def getColSpan(self, row, col): | |
778 cellFormatter = self.flextable.getFlexCellFormatter() | |
779 return cellFormatter.getColSpan(row, col) | |
780 | |
781 def setColSpan(self, row, col, value): | |
782 cellFormatter = self.flextable.getFlexCellFormatter() | |
783 return cellFormatter.setColSpan(row, col, value) | |
784 | |
785 def getRowSpan(self, row, col): | |
786 cellFormatter = self.flextable.getFlexCellFormatter() | |
787 return cellFormatter.getRowSpan(row, col) | |
788 | |
789 def setRowSpan(self, row, col, value): | |
790 cellFormatter = self.flextable.getFlexCellFormatter() | |
791 return cellFormatter.setRowSpan(row, col, value) | |
792 | |
753 class MainDiscussionPanel(HorizontalPanel): | 793 class MainDiscussionPanel(HorizontalPanel): |
754 | 794 |
755 def __init__(self, host): | 795 def __init__(self, host): |
756 self.host=host | 796 self.host=host |
757 HorizontalPanel.__init__(self) | 797 HorizontalPanel.__init__(self) |