433 pre-defined height button |
433 pre-defined height button |
434 @param height: Height that change Viewer to |
434 @param height: Height that change Viewer to |
435 @return: callback function |
435 @return: callback function |
436 """ |
436 """ |
437 def OnChangeSizeButton(): |
437 def OnChangeSizeButton(): |
438 self.SetCanvasSize(200, height) |
438 self.SetCanvasHeight(height) |
439 return OnChangeSizeButton |
439 return OnChangeSizeButton |
440 |
440 |
441 def OnExportGraphButton(self): |
441 def OnExportGraphButton(self): |
442 """ |
442 """ |
443 Function called when Viewer Export button is pressed |
443 Function called when Viewer Export button is pressed |
632 yw + height - event.y) |
632 yw + height - event.y) |
633 |
633 |
634 # If a Viewer resize is in progress, change Viewer size |
634 # If a Viewer resize is in progress, change Viewer size |
635 elif event.button == 1 and self.CanvasStartSize is not None: |
635 elif event.button == 1 and self.CanvasStartSize is not None: |
636 width, height = self.GetSize() |
636 width, height = self.GetSize() |
637 self.SetCanvasSize(width, |
637 self.SetCanvasHeight( |
638 self.CanvasStartSize + height - event.y - self.MouseStartPos.y) |
638 self.CanvasStartSize + height - event.y - self.MouseStartPos.y) |
639 |
639 |
640 # If no button is pressed, show or hide contextual buttons or resize |
640 # If no button is pressed, show or hide contextual buttons or resize |
641 # highlight |
641 # highlight |
642 elif event.button is None: |
642 elif event.button is None: |
807 # inside figure and border around figure |
807 # inside figure and border around figure |
808 return wx.Size(200, |
808 return wx.Size(200, |
809 CANVAS_BORDER[0] + CANVAS_BORDER[1] + |
809 CANVAS_BORDER[0] + CANVAS_BORDER[1] + |
810 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items)) |
810 2 * CANVAS_PADDING + VALUE_LABEL_HEIGHT * len(self.Items)) |
811 |
811 |
812 def SetCanvasSize(self, width, height): |
812 def SetCanvasHeight(self, height): |
813 """ |
813 """ |
814 Set Viewer size checking that it respects Viewer minimum size |
814 Set Viewer size checking that it respects Viewer minimum size |
815 @param width: Viewer width |
|
816 @param height: Viewer height |
815 @param height: Viewer height |
817 """ |
816 """ |
818 height = max(height, self.GetCanvasMinSize()[1]) |
817 min_width, min_height = self.GetCanvasMinSize() |
819 self.SetMinSize(wx.Size(width, height)) |
818 height = max(height, min_height) |
|
819 self.SetMinSize(wx.Size(min_width, height)) |
820 self.RefreshLabelsPosition(height) |
820 self.RefreshLabelsPosition(height) |
821 self.ParentWindow.RefreshGraphicsSizer() |
821 self.ParentWindow.RefreshGraphicsSizer() |
822 |
822 |
823 def GetAxesBoundingBox(self, parent_coordinate=False): |
823 def GetAxesBoundingBox(self, parent_coordinate=False): |
824 """ |
824 """ |
974 add_text_func(size='large', |
974 add_text_func(size='large', |
975 horizontalalignment='right')) |
975 horizontalalignment='right')) |
976 |
976 |
977 # Y coordinate labels are vertical and in figure left side |
977 # Y coordinate labels are vertical and in figure left side |
978 self.AxesLabels.append( |
978 self.AxesLabels.append( |
979 add_text_func(size='small', rotation='vertical')) |
979 add_text_func(size='small', rotation='vertical', |
|
980 verticalalignment='bottom')) |
980 self.Labels.append( |
981 self.Labels.append( |
981 add_text_func(size='large', rotation='vertical', |
982 add_text_func(size='large', rotation='vertical', |
982 verticalalignment='top')) |
983 verticalalignment='top')) |
983 |
984 |
984 # Refresh position of labels according to Viewer size |
985 # Refresh position of labels according to Viewer size |