Changeset 914c49d5 in sasview for src/sas/sasgui
- Timestamp:
- May 2, 2017 8:05:48 AM (8 years ago)
- Branches:
- master, ESS_GUI, ESS_GUI_Docs, ESS_GUI_batch_fitting, ESS_GUI_bumps_abstraction, ESS_GUI_iss1116, ESS_GUI_iss879, ESS_GUI_iss959, ESS_GUI_opencl, ESS_GUI_ordering, ESS_GUI_sync_sascalc, costrafo411, magnetic_scatt, release-4.2.2, ticket-1009, ticket-1094-headless, ticket-1242-2d-resolution, ticket-1243, ticket-1249, ticket885, unittest-saveload
- Children:
- 8e15dce
- Parents:
- 6e6dd4c (diff), 658dd57 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - Location:
- src/sas/sasgui
- Files:
-
- 1 added
- 1 deleted
- 22 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/sas/sasgui/guiframe/config.py
rea45bfe ra1b8fee 2 2 Application settings 3 3 """ 4 from __future__ import print_function 5 4 6 import time 5 7 import os … … 150 152 :TODO - Need method doc string 151 153 """ 152 print "%g: %s" % (time.clock(), message)154 print("%g: %s" % (time.clock(), message)) 153 155 154 156 if __EVT_DEBUG_2_FILE__: -
src/sas/sasgui/guiframe/data_panel.py
r959eb01 ra1b8fee 11 11 This module provides Graphic interface for the data_manager module. 12 12 """ 13 from __future__ import print_function 14 13 15 import wx 14 16 from wx.build import build_options … … 514 516 self.parent.save_data2d(data, default_name) 515 517 else: 516 print "unable to save this type of data"518 print("unable to save this type of data") 517 519 518 520 def layout_data_list(self): … … 1497 1499 except: 1498 1500 # raise 1499 print "error", sys.exc_value1501 print("error", sys.exc_value) 1500 1502 1501 1503 app.MainLoop() -
src/sas/sasgui/guiframe/data_processor.py
r7432acb ra1b8fee 18 18 19 19 """ 20 from __future__ import print_function 21 20 22 import os 21 23 import sys … … 2035 2037 frame.Show(True) 2036 2038 except: 2037 print sys.exc_value2039 print(sys.exc_value) 2038 2040 2039 2041 app.MainLoop() -
src/sas/sasgui/guiframe/dummyapp.py
r959eb01 ra1b8fee 3 3 Allows the user to set an external data manager 4 4 """ 5 from __future__ import print_function 6 5 7 import sas.sasgui.guiframe.gui_manager as gui_manager 6 8 … … 32 34 plug_menu.Append(id, '&Do something') 33 35 def _on_do_something(event): 34 print "Do something"36 print("Do something") 35 37 wx.EVT_MENU(self.parent, id, _on_do_something) 36 38 -
src/sas/sasgui/guiframe/gui_style.py
r959eb01 ra1b8fee 3 3 Provide the style for guiframe 4 4 """ 5 from __future__ import print_function 6 5 7 import wx 6 8 import os … … 79 81 if __name__ == "__main__": 80 82 81 print GUIFRAME.DEFAULT_STYLE82 print GUIFRAME.FLOATING_PANEL83 print GUIFRAME.SINGLE_APPLICATION83 print(GUIFRAME.DEFAULT_STYLE) 84 print(GUIFRAME.FLOATING_PANEL) 85 print(GUIFRAME.SINGLE_APPLICATION) 84 86 style = GUIFRAME.MULTIPLE_APPLICATIONS 85 87 style &= GUIFRAME.PLOTTING_ON 86 print style == GUIFRAME.PLOTTING_ON88 print(style == GUIFRAME.PLOTTING_ON) 87 89 style1 = GUIFRAME.MULTIPLE_APPLICATIONS 88 90 style1 &= (~GUIFRAME.MANAGER_ON) 89 print style1 == GUIFRAME.DEFAULT_STYLE90 print style191 print(style1 == GUIFRAME.DEFAULT_STYLE) 92 print(style1) -
src/sas/sasgui/guiframe/proxy.py
r463e7ffc ra1b8fee 1 1 #!/usr/bin/env python 2 2 # -*- coding: utf-8 -*- 3 from __future__ import print_function 4 3 5 import urllib2 4 6 import sys … … 157 159 response = c.connect() 158 160 if response is not None: 159 print 50 * '-'161 print(50 * '-') 160 162 content = json.loads(response.read().strip()) 161 163 pprint(content) -
src/sas/sasgui/perspectives/calculator/detector_editor.py
r959eb01 ra1b8fee 1 from __future__ import print_function 1 2 2 3 import wx … … 34 35 self.set_values() 35 36 except: 36 print "error", sys.exc_value37 print("error", sys.exc_value) 37 38 38 39 def _define_structure(self): -
src/sas/sasgui/perspectives/calculator/gen_scatter_panel.py
r7432acb ra1b8fee 3 3 This module relies on guiframe manager. 4 4 """ 5 from __future__ import print_function 5 6 6 7 import wx … … 1998 1999 self.panel.set_volume_ctl_val(str(val)) 1999 2000 except: 2000 print "self.panel is not initialized yet"2001 print("self.panel is not initialized yet") 2001 2002 2002 2003 def set_omfpanel_default_shap(self, shape): -
src/sas/sasgui/perspectives/calculator/image_viewer.py
r7432acb ra1b8fee 1 from __future__ import print_function 2 1 3 import os 2 4 import sys … … 78 80 wx.PostEvent(parent, StatusEvent(status=err_msg, info="error")) 79 81 else: 80 print err_msg82 print(err_msg) 81 83 82 84 def choose_data_file(self, location=None): … … 301 303 info="error")) 302 304 else: 303 print err_msg305 print(err_msg) 304 306 return flag 305 307 … … 332 334 info="error")) 333 335 else: 334 print err_msg336 print(err_msg) 335 337 return flag 336 338 … … 361 363 info="error")) 362 364 else: 363 print err_msg365 print(err_msg) 364 366 365 367 self.OnClose(event) -
src/sas/sasgui/perspectives/calculator/model_editor.py
r7432acb ra1b8fee 23 23 #copyright 2009, University of Tennessee 24 24 ################################################################################ 25 from __future__ import print_function 26 25 27 import wx 26 28 import sys … … 871 873 # Put the cursor at appropriate position 872 874 length = len(label) 873 print length875 print(length) 874 876 if label[length-1] == ')': 875 877 length -= 1 -
src/sas/sasgui/perspectives/fitting/basepage.py
rac0578c r914c49d5 2 2 Base Page for fitting 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import os … … 657 659 # It seems MAC needs wxCallAfter 658 660 if event.GetId() == GUIFRAME_ID.COPYEX_ID: 659 print "copy excel"661 print("copy excel") 660 662 wx.CallAfter(self.get_copy_excel) 661 663 elif event.GetId() == GUIFRAME_ID.COPYLAT_ID: 662 print "copy latex"664 print("copy latex") 663 665 wx.CallAfter(self.get_copy_latex) 664 666 else: … … 3368 3370 except Exception: 3369 3371 logger.error(traceback.format_exc()) 3370 print 3371 sys.exc_info()[1] 3372 print("Error in BasePage._paste_poly_help: %s" % \ 3373 sys.exc_info()[1]) 3372 3374 3373 3375 def _set_disp_cb(self, isarray, item): … … 3398 3400 Moveit; This method doesn't belong here 3399 3401 """ 3400 print "BasicPage.update_pinhole_smear was called: skipping"3402 print("BasicPage.update_pinhole_smear was called: skipping") 3401 3403 return 3402 3404 … … 3574 3576 # check model type to show sizer 3575 3577 if self.model is not None: 3576 print "_set_model_sizer_selection: disabled."3578 print("_set_model_sizer_selection: disabled.") 3577 3579 # self._set_model_sizer_selection(self.model) 3578 3580 -
src/sas/sasgui/perspectives/fitting/fitting.py
r7432acb ra1b8fee 11 11 #copyright 2009, University of Tennessee 12 12 ################################################################################ 13 from __future__ import print_function 14 13 15 import re 14 16 import sys … … 1253 1255 """ 1254 1256 """ 1255 print "update_fit result", result1257 print("update_fit result", result) 1256 1258 1257 1259 def _batch_fit_complete(self, result, pars, page_id, … … 2046 2048 res = (fn - gn) / en 2047 2049 except ValueError: 2048 print "Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))2050 print("Unmatch lengths %s, %s, %s" % (len(fn), len(gn), len(en))) 2049 2051 return 2050 2052 -
src/sas/sasgui/perspectives/fitting/media/plugin.rst
r984f3fc r72100ee 538 538 sin, cos, tan, asin, acos, atan: 539 539 Trigonometry functions and inverses, operating on radians. 540 sinh, cos , tanh, asinh, acosh, atanh:540 sinh, cosh, tanh, asinh, acosh, atanh: 541 541 Hyperbolic trigonometry functions. 542 542 atan2(y,x): -
src/sas/sasgui/perspectives/fitting/models.py
r463e7ffc ra1b8fee 2 2 Utilities to manage models 3 3 """ 4 from __future__ import print_function 5 4 6 import traceback 5 7 import os … … 141 143 type, value, tb = sys.exc_info() 142 144 if type is not None and issubclass(type, py_compile.PyCompileError): 143 print "Problem with", repr(value)145 print("Problem with", repr(value)) 144 146 raise type, value, tb 145 147 return 1 -
src/sas/sasgui/perspectives/pr/pr.py
r7432acb ra1b8fee 15 15 # Make sure the option of saving each curve is available 16 16 # Use the I(q) curve as input and compare the output to P(r) 17 from __future__ import print_function 17 18 18 19 import sys … … 230 231 out, cov = pr.pr_fit() 231 232 for i in range(len(out)): 232 print "%g +- %g" % (out[i], math.sqrt(cov[i][i]))233 print("%g +- %g" % (out[i], math.sqrt(cov[i][i]))) 233 234 234 235 # Show input P(r) … … 318 319 except: 319 320 err[i] = 1.0 320 print "Error getting error", value, x[i]321 print("Error getting error", value, x[i]) 321 322 322 323 new_plot = Data1D(x, y) -
src/sas/sasgui/perspectives/simulation/ShapeParameters.py
rd85c194 ra1b8fee 8 8 copyright 2009, University of Tennessee 9 9 """ 10 from __future__ import print_function 11 10 12 import wx 11 13 import sys … … 312 314 self.parent.GetSizer().Layout() 313 315 except: 314 print "TODO: move the Layout call of editShape up to the caller"316 print("TODO: move the Layout call of editShape up to the caller") 315 317 316 318 def _readCtrlFloat(self, ctrl): … … 392 394 self.current_shape.params[item[0]] = tmp 393 395 except: 394 print "Could not create"395 print sys.exc_value396 print("Could not create") 397 print(sys.exc_value) 396 398 397 399 def _onCreate(self, evt): … … 485 487 indices = self.shape_listbox.GetSelections() 486 488 if len(indices)>0: 487 print "NOT YET IMPLMENTED"488 print "renaming", self.shape_listbox.GetString(indices[0])489 489 print("NOT YET IMPLMENTED") 490 print("renaming", self.shape_listbox.GetString(indices[0])) 491 -
src/sas/sasgui/plottools/PlotPanel.py
r7432acb ra1b8fee 2 2 Plot panel. 3 3 """ 4 from __future__ import print_function 5 4 6 import logging 5 7 import traceback … … 38 40 def show_tree(obj, d=0): 39 41 """Handy function for displaying a tree of graph objects""" 40 print "%s%s" % ("-"*d, obj.__class__.__name__)42 print("%s%s" % ("-"*d, obj.__class__.__name__)) 41 43 if 'get_children' in dir(obj): 42 44 for a in obj.get_children(): show_tree(a, d + 1) … … 2014 2016 self.toolbar.copy_figure(self.canvas) 2015 2017 except: 2016 print "Error in copy Image"2018 print("Error in copy Image") 2017 2019 2018 2020 -
src/sas/sasgui/plottools/binder.py
r463e7ffc ra1b8fee 2 2 Extension to MPL to support the binding of artists to key/mouse events. 3 3 """ 4 from __future__ import print_function 5 4 6 import sys 5 7 import logging … … 63 65 ] 64 66 except: 65 print "bypassing scroll_event: wrong matplotlib version"67 print("bypassing scroll_event: wrong matplotlib version") 66 68 self._connections = [ 67 69 canvas.mpl_connect('motion_notify_event', self._onMotion), -
src/sas/sasgui/plottools/convert_units.py
r959eb01 ra1b8fee 3 3 This is a cleaned up version of unitConverter.py 4 4 """ 5 from __future__ import print_function 6 5 7 import re 6 8 import string … … 68 70 unit8 = "m/s^{4}" # x^2 (m/s^{4})^{2} 69 71 70 print "this unit1 %s ,its powerer %s , and value %s" % (unit1, 1, convert_unit(1, unit1))71 print "this unit2 %s ,its powerer %s , and value %s" % (unit2, 1, convert_unit(1, unit2))72 print "this unit3 %s ,its powerer %s , and value %s" % (unit3, 2, convert_unit(2, unit3))73 print "this unit4 %s ,its powerer %s , and value %s" % (unit4, -1, convert_unit(-1, unit4))74 print "this unit5 %s ,its powerer %s , and value %s" % (unit5, 2, convert_unit(2, unit5))75 print "this unit6 %s ,its powerer %s , and value %s" % (unit6, 2, convert_unit(2, unit6))76 print "this unit7 %s ,its powerer %s , and value %s" % (unit7, -1, convert_unit(-1, unit7))77 print "this unit8 %s ,its powerer %s , and value %s" % (unit8, 2, convert_unit(2, unit8))78 print "this unit9 %s ,its powerer %s , and value %s" % (unit9, 2, convert_unit(2, unit9))72 print("this unit1 %s ,its powerer %s , and value %s" % (unit1, 1, convert_unit(1, unit1))) 73 print("this unit2 %s ,its powerer %s , and value %s" % (unit2, 1, convert_unit(1, unit2))) 74 print("this unit3 %s ,its powerer %s , and value %s" % (unit3, 2, convert_unit(2, unit3))) 75 print("this unit4 %s ,its powerer %s , and value %s" % (unit4, -1, convert_unit(-1, unit4))) 76 print("this unit5 %s ,its powerer %s , and value %s" % (unit5, 2, convert_unit(2, unit5))) 77 print("this unit6 %s ,its powerer %s , and value %s" % (unit6, 2, convert_unit(2, unit6))) 78 print("this unit7 %s ,its powerer %s , and value %s" % (unit7, -1, convert_unit(-1, unit7))) 79 print("this unit8 %s ,its powerer %s , and value %s" % (unit8, 2, convert_unit(2, unit8))) 80 print("this unit9 %s ,its powerer %s , and value %s" % (unit9, 2, convert_unit(2, unit9))) -
src/sas/sasgui/plottools/fittings.py
rac07a3a ra1b8fee 14 14 15 15 """ 16 from __future__ import print_function 17 16 18 from scipy import optimize 17 19 … … 106 108 chisqr, out, cov = sasfit(line, [cstA, cstB], event.x, y, 0) 107 109 # print "Output parameters:", out 108 print "The right answer is [70.0, 1.0]"109 print chisqr, out, cov110 print("The right answer is [70.0, 1.0]") 111 print(chisqr, out, cov) -
src/sas/sasgui/plottools/plottable_interactor.py
r45dffa69 ra1b8fee 2 2 This module allows more interaction with the plot 3 3 """ 4 from __future__ import print_function 5 4 6 from BaseInteractor import _BaseInteractor 7 5 8 6 9 class PointInteractor(_BaseInteractor): … … 156 159 157 160 def clear(self): 158 print "plottable_interactor.clear()"161 print("plottable_interactor.clear()") 159 162 160 163 def _on_click(self, evt): -
src/sas/sasgui/guiframe/local_perspectives/plotting/Plotter2D.py
r7432acb r3e5648b 361 361 if self.slicer.__class__.__name__ != "BoxSum": 362 362 wx_id = ids.next() 363 slicerpop.Append(wx_id, '&Edit Slicer Parameters') 363 name = '&Edit Slicer Parameters and Batch Slicing' 364 slicerpop.Append(wx_id, name) 364 365 wx.EVT_MENU(self, wx_id, self._onEditSlicer) 365 366 slicerpop.AppendSeparator() … … 532 533 533 534 """ 534 # #Clear current slicer535 # Clear current slicer 535 536 if self.slicer is not None: 536 537 self.slicer.clear() 537 # #Create a new slicer538 # Create a new slicer 538 539 self.slicer_z += 1 539 540 self.slicer = slicer(self, self.subplot, zorder=self.slicer_z) 540 541 self.subplot.set_ylim(self.data2D.ymin, self.data2D.ymax) 541 542 self.subplot.set_xlim(self.data2D.xmin, self.data2D.xmax) 542 # #Draw slicer543 # Draw slicer 543 544 self.update() 544 545 self.slicer.update() … … 572 573 npt = math.floor(npt) 573 574 from sas.sascalc.dataloader.manipulations import CircularAverage 574 # #compute the maximum radius of data2D575 # compute the maximum radius of data2D 575 576 self.qmax = max(math.fabs(self.data2D.xmax), 576 577 math.fabs(self.data2D.xmin)) … … 578 579 math.fabs(self.data2D.ymin)) 579 580 self.radius = math.sqrt(math.pow(self.qmax, 2) + math.pow(self.ymax, 2)) 580 # #Compute beam width581 # Compute beam width 581 582 bin_width = (self.qmax + self.qmax) / npt 582 # #Create data1D circular average of data2D583 # Create data1D circular average of data2D 583 584 Circle = CircularAverage(r_min=0, r_max=self.radius, 584 585 bin_width=bin_width) … … 599 600 new_plot.name = "Circ avg " + self.data2D.name 600 601 new_plot.source = self.data2D.source 601 # new_plot.info = self.data2D.info602 # new_plot.info = self.data2D.info 602 603 new_plot.interactive = True 603 604 new_plot.detector = self.data2D.detector 604 605 605 # #If the data file does not tell us what the axes are, just assume...606 # If the data file does not tell us what the axes are, just assume... 606 607 new_plot.xaxis("\\rm{Q}", "A^{-1}") 607 608 if hasattr(self.data2D, "scale") and \ … … 615 616 new_plot.id = "Circ avg " + self.data2D.name 616 617 new_plot.is_data = True 617 self.parent.update_theory(data_id=self.data2D.id, \ 618 theory=new_plot) 618 self.parent.update_theory(data_id=self.data2D.id, theory=new_plot) 619 619 wx.PostEvent(self.parent, 620 620 NewPlotEvent(plot=new_plot, title=new_plot.name)) … … 630 630 """ 631 631 if self.slicer is not None: 632 from SlicerParametersimport SlicerParameterPanel632 from parameters_panel_slicer import SlicerParameterPanel 633 633 dialog = SlicerParameterPanel(self, -1, "Slicer Parameters") 634 634 dialog.set_slicer(self.slicer.__class__.__name__, … … 668 668 params = self.slicer.get_params() 669 669 ## Create a new panel to display results of summation of Data2D 670 from slicerpanelimport SlicerPanel670 from parameters_panel_boxsum import SlicerPanel 671 671 win = MDIFrame(self.parent, None, 'None', (100, 200)) 672 672 new_panel = SlicerPanel(parent=win, id=-1, … … 758 758 if default_name.count('.') > 0: 759 759 default_name = default_name.split('.')[0] 760 #default_name += "_out"761 760 if self.parent is not None: 762 761 self.parent.show_data2d(data, default_name) 763 762 764 763 def modifyGraphAppearance(self, e): 765 self.graphApp = graphAppearance(self, 'Modify graph appearance', legend=False) 764 self.graphApp = graphAppearance(self, 'Modify graph appearance', 765 legend=False) 766 766 self.graphApp.setDefaults(self.grid_on, self.legend_on, 767 767 self.xaxis_label, self.yaxis_label, -
src/sas/sasgui/guiframe/local_perspectives/plotting/parameters_panel_boxsum.py
r7432acb r37d461c 1 1 import wx 2 2 import wx.lib.newevent 3 #from copy import deepcopy 3 from parameters_panel_slicer import SlicerParameterPanel 4 4 from sas.sasgui.guiframe.utils import format_number 5 from sas.sasgui.guiframe. events import SlicerParameterEvent6 from sas.sasgui.guiframe.events import EVT_SLICER_PARS7 from sas.sasgui.guiframe.events import EVT_SLICER 5 from sas.sasgui.guiframe.panel_base import PanelBase 6 from sas.sasgui.guiframe.events import (SlicerParameterEvent, EVT_SLICER_PARS, 7 EVT_SLICER) 8 8 9 from sas.sasgui.guiframe.panel_base import PanelBase10 9 11 10 class SlicerPanel(wx.Panel, PanelBase): … … 13 12 Panel class to show the slicer parameters 14 13 """ 15 #TODO: show units 16 #TODO: order parameters properly 17 ## Internal name for the AUI manager 14 # Internal name for the AUI manager 18 15 window_name = "Slicer panel" 19 # #Title to appear on top of the window16 # Title to appear on top of the window 20 17 window_caption = "Slicer Panel" 21 18 CENTER_PANE = False … … 25 22 wx.Panel.__init__(self, parent, id, *args, **kwargs) 26 23 PanelBase.__init__(self) 27 # #Initialization of the class24 # Initialization of the class 28 25 self.base = base 29 26 if params is None: … … 44 41 else: 45 42 self.set_slicer(type, params) 46 ## Bindings 47 self.parent.Bind(EVT_SLICER, self.onEVT_SLICER) 48 self.parent.Bind(EVT_SLICER_PARS, self.onParamChange) 49 50 def onEVT_SLICER(self, event): 51 """ 52 Process EVT_SLICER events 53 When the slicer changes, update the panel 54 55 :param event: EVT_SLICER event 56 57 """ 58 event.Skip() 59 if event.obj_class is None: 60 self.set_slicer(None, None) 61 else: 62 self.set_slicer(event.type, event.params) 43 # Bindings 44 self.parent.Bind(EVT_SLICER, SlicerParameterPanel.on_evt_slicer) 45 self.parent.Bind(EVT_SLICER_PARS, SlicerParameterPanel.on_param_change) 63 46 64 47 def set_slicer(self, type, params): … … 84 67 keys.sort() 85 68 for item in keys: 86 if not item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 69 if not item.lower() in ["num_points", "avg", "avg_error", "sum", 70 "sum_error"]: 87 71 n += 1 88 72 text = wx.StaticText(self, -1, item, style=wx.ALIGN_LEFT) 89 73 self.bck.Add(text, (n - 1, 0), 90 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, border=15) 74 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 75 border=15) 91 76 ctl = wx.TextCtrl(self, -1, size=(80, 20), 92 77 style=wx.TE_PROCESS_ENTER) … … 95 80 ctl.SetToolTipString(hint_msg) 96 81 ctl.SetValue(str(format_number(params[item]))) 97 self.Bind(wx.EVT_TEXT_ENTER, self.on TextEnter)98 ctl.Bind(wx.EVT_SET_FOCUS, self.on SetFocus)99 ctl.Bind(wx.EVT_KILL_FOCUS, self.on TextEnter)82 self.Bind(wx.EVT_TEXT_ENTER, self.on_text_enter) 83 ctl.Bind(wx.EVT_SET_FOCUS, self.on_set_focus) 84 ctl.Bind(wx.EVT_KILL_FOCUS, self.on_text_enter) 100 85 self.parameters.append([item, ctl]) 101 self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 86 self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 87 border=0) 102 88 for item in keys: 103 if item.lower() in ["num_points", "avg", "avg_error", "sum", "sum_error"]: 89 if item.lower() in ["num_points", "avg", "avg_error", "sum", 90 "sum_error"]: 104 91 n += 1 105 text = wx.StaticText(self, -1, item + ": ", style=wx.ALIGN_LEFT) 106 self.bck.Add(text, (n - 1, 0), flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 92 text = wx.StaticText(self, -1, item + ": ", 93 style=wx.ALIGN_LEFT) 94 self.bck.Add(text, (n - 1, 0), 95 flag=wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 107 96 border=15) 108 97 ctl = wx.StaticText(self, -1, … … 110 99 style=wx.ALIGN_LEFT) 111 100 ctl.SetToolTipString("Result %s" % item) 112 self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, border=0) 101 self.bck.Add(ctl, (n - 1, 1), flag=wx.TOP | wx.BOTTOM, 102 border=0) 113 103 self.bck.Layout() 114 104 self.Layout() 115 p sizer = self.parent.GetSizer()116 if p sizer is not None:117 p sizer.Layout()105 p_sizer = self.parent.GetSizer() 106 if p_sizer is not None: 107 p_sizer.Layout() 118 108 119 def on SetFocus(self, evt):109 def on_set_focus(self, evt): 120 110 """ 121 111 Highlight the txtcrtl … … 126 116 # Select the whole control, after this event resolves 127 117 wx.CallAfter(widget.SetSelection, -1, -1) 128 return129 118 130 def onParamChange(self, evt): 131 """ 132 Receive and event and reset the text field contained in self.parameters 133 134 """ 135 evt.Skip() 136 for item in self.parameters: 137 if item[0] in evt.params: 138 item[1].SetValue(format_number(evt.params[item[0]])) 139 item[1].Refresh() 140 141 def onTextEnter(self, evt): 119 def on_text_enter(self, evt): 142 120 """ 143 121 Parameters have changed … … 149 127 try: 150 128 params[item[0]] = float(item[1].GetValue()) 151 item[1].SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW)) 129 item[1].SetBackgroundColour(wx.SystemSettings_GetColour( 130 wx.SYS_COLOUR_WINDOW)) 152 131 item[1].Refresh() 153 132 except: … … 155 134 item[1].SetBackgroundColour("pink") 156 135 item[1].Refresh() 157 158 if has_error == False: 136 if not has_error: 159 137 # Post parameter event 160 # #base is guiframe is this case138 # base is guiframe is this case 161 139 event = SlicerParameterEvent(type=self.type, params=params) 162 140 wx.PostEvent(self.base, event) … … 166 144 On Close Event 167 145 """ 168 ID= self.uid169 self.parent.delete_panel( ID)146 uid = self.uid 147 self.parent.delete_panel(uid) 170 148 self.frame.Destroy()
Note: See TracChangeset
for help on using the changeset viewer.