plot and duplications fixes
This commit is contained in:
		@@ -1,6 +1,5 @@
 | 
				
			|||||||
# -*- coding: utf-8 -*-
 | 
					# -*- coding: utf-8 -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import wx
 | 
					import wx
 | 
				
			||||||
import wx.gizmos
 | 
					import wx.gizmos
 | 
				
			||||||
import wx.grid
 | 
					import wx.grid
 | 
				
			||||||
@@ -230,9 +229,10 @@ class MainFrame(wx.Frame):
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        tb1.AddSimpleTool(ID_ADD_MODEL_SELECTED, "model-new", wx.Bitmap('share/model-add.png'),
 | 
					        tb1.AddSimpleTool(ID_ADD_MODEL_SELECTED, "model-new", wx.Bitmap('share/model-add.png'),
 | 
				
			||||||
            'Add spacification to selected model')
 | 
					            'Add spacification to selected model')
 | 
				
			||||||
        tb1.AddSeparator()
 | 
					 | 
				
			||||||
        tb1.AddSimpleTool(ID_DUPLICATE_MODEL, "model-dup", wx.Bitmap('share/model-dup.png'),
 | 
					        tb1.AddSimpleTool(ID_DUPLICATE_MODEL, "model-dup", wx.Bitmap('share/model-dup.png'),
 | 
				
			||||||
            'Duplicate selected model')
 | 
					            'Duplicate selected model')
 | 
				
			||||||
 | 
					        tb1.AddSimpleTool(ID_DUPLICATE_TREE, "model-dup-tree", wx.Bitmap('share/model-dup-tree.png'),
 | 
				
			||||||
 | 
					            'Duplicate selected model and all submodels')
 | 
				
			||||||
        tb1.AddSimpleTool(ID_DELETE_MODEL, "model-del", wx.Bitmap('share/model-delete.png'),
 | 
					        tb1.AddSimpleTool(ID_DELETE_MODEL, "model-del", wx.Bitmap('share/model-delete.png'),
 | 
				
			||||||
            'Delete selected model')
 | 
					            'Delete selected model')
 | 
				
			||||||
        tb1.AddSeparator()
 | 
					        tb1.AddSeparator()
 | 
				
			||||||
@@ -352,16 +352,29 @@ class SizeSelector(wx.Dialog):
 | 
				
			|||||||
    def GetValues(self):
 | 
					    def GetValues(self):
 | 
				
			||||||
        return self.width.GetValue(), self.height.GetValue()
 | 
					        return self.width.GetValue(), self.height.GetValue()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					HandCursorImage = wx.Image('share/cursor-openhand.png')
 | 
				
			||||||
 | 
					GrabHandCursorImage = wx.Image('share/cursor-closedhand.png')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class PlotFrame(wx.Frame):
 | 
					class PlotFrame(wx.Frame):
 | 
				
			||||||
    def __init__(self, parent, title):
 | 
					    def __init__(self, parent, title):
 | 
				
			||||||
        wx.Frame.__init__ (self, parent, -1, title, size = wx.Size(600, 400))
 | 
					        wx.Frame.__init__ (self, parent, -1, title, size = wx.Size(600, 400))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.plot = wxplot.PlotCanvas(self)
 | 
					        self.plot = wxplot.PlotCanvas(self)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        # стандартные курсоры компонента настолько монстроуозные,
 | 
				
			||||||
 | 
					        # что их просто необходимо заменить на что-нибудь приличное
 | 
				
			||||||
 | 
					        self.plot.canvas.SetCursor(wx.STANDARD_CURSOR)
 | 
				
			||||||
 | 
					        self.plot.HandCursor = wx.CursorFromImage(HandCursorImage)
 | 
				
			||||||
 | 
					        self.plot.GrabHandCursor = wx.CursorFromImage(GrabHandCursorImage)
 | 
				
			||||||
 | 
					        # все равно не используется
 | 
				
			||||||
 | 
					        # self.plot.MagCursor = wx.StockCursor(wx.CURSOR_MAGNIFIER)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.plot.SetGridColour(wx.Color(200, 200, 200))
 | 
					        self.plot.SetGridColour(wx.Color(200, 200, 200))
 | 
				
			||||||
        self.plot.SetEnableGrid(True)
 | 
					        self.plot.SetEnableGrid(True)
 | 
				
			||||||
        self.plot.SetEnableAntiAliasing(True)
 | 
					        self.plot.SetEnableAntiAliasing(True)
 | 
				
			||||||
        self.plot.SetEnableHiRes(True)
 | 
					        self.plot.SetEnableHiRes(True)
 | 
				
			||||||
        self.plot.SetEnableLegend(True)
 | 
					        self.plot.SetEnableLegend(True)
 | 
				
			||||||
 | 
					        self.plot.SetEnableDrag(True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.Centre(wx.BOTH)
 | 
					        self.Centre(wx.BOTH)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -371,6 +384,15 @@ class PlotFrame(wx.Frame):
 | 
				
			|||||||
        menubar.Append(menu, 'Plot')
 | 
					        menubar.Append(menu, 'Plot')
 | 
				
			||||||
        self.SetMenuBar(menubar)
 | 
					        self.SetMenuBar(menubar)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.plot.Bind(wx.EVT_MOUSEWHEEL, self.OnZoom)        
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    def OnZoom(self, event):
 | 
				
			||||||
 | 
					        x = event.GetX()
 | 
				
			||||||
 | 
					        y = event.GetY()
 | 
				
			||||||
 | 
					        r = event.GetWheelRotation()
 | 
				
			||||||
 | 
					        x, y = self.plot.PositionScreenToUser((x, y))
 | 
				
			||||||
 | 
					        delta = 0.8/1.0 if r > 0 else 1.0/0.8
 | 
				
			||||||
 | 
					        self.plot.Zoom((x, y), (delta, delta))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class AboutDialog(wx.Dialog):
 | 
					class AboutDialog(wx.Dialog):
 | 
				
			||||||
    def __init__(self, parent):
 | 
					    def __init__(self, parent):
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -18,8 +18,6 @@ import wx.propgrid as wxpg
 | 
				
			|||||||
import wx.lib.plot as wxplot
 | 
					import wx.lib.plot as wxplot
 | 
				
			||||||
import forms
 | 
					import forms
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import datetime
 | 
					 | 
				
			||||||
import os
 | 
					 | 
				
			||||||
import threading
 | 
					import threading
 | 
				
			||||||
import re
 | 
					import re
 | 
				
			||||||
from wx.lib.embeddedimage import PyEmbeddedImage
 | 
					from wx.lib.embeddedimage import PyEmbeddedImage
 | 
				
			||||||
@@ -85,7 +83,7 @@ class MainFrame(forms.MainFrame):
 | 
				
			|||||||
        # События компонентов
 | 
					        # События компонентов
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.m_user_models.Bind(wx.EVT_TREE_SEL_CHANGED,
 | 
					        self.m_user_models.Bind(wx.EVT_TREE_SEL_CHANGED,
 | 
				
			||||||
            self.OnModelActivated)
 | 
					            self.OnModelSelected)
 | 
				
			||||||
        self.m_user_models.Bind(wx.EVT_TREE_DELETE_ITEM,
 | 
					        self.m_user_models.Bind(wx.EVT_TREE_DELETE_ITEM,
 | 
				
			||||||
            self.OnDeleteModelsItem)
 | 
					            self.OnDeleteModelsItem)
 | 
				
			||||||
        self.m_params.Bind(wxpg.EVT_PG_CHANGING,
 | 
					        self.m_params.Bind(wxpg.EVT_PG_CHANGING,
 | 
				
			||||||
@@ -441,7 +439,7 @@ class MainFrame(forms.MainFrame):
 | 
				
			|||||||
            pg.Append(wxpg.StringProperty(label, value = str(param.GetValue())))
 | 
					            pg.Append(wxpg.StringProperty(label, value = str(param.GetValue())))
 | 
				
			||||||
        pg.SetSplitterLeft()
 | 
					        pg.SetSplitterLeft()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def OnModelActivated(self, event):
 | 
					    def OnModelSelected(self, event):
 | 
				
			||||||
        item = event.GetItem()
 | 
					        item = event.GetItem()
 | 
				
			||||||
        data = self.m_user_models.GetPyData(item)
 | 
					        data = self.m_user_models.GetPyData(item)
 | 
				
			||||||
        if data:
 | 
					        if data:
 | 
				
			||||||
@@ -474,6 +472,8 @@ class MainFrame(forms.MainFrame):
 | 
				
			|||||||
        param = prop.GetClientData()
 | 
					        param = prop.GetClientData()
 | 
				
			||||||
        item, data = self.GetSelectedItemData(um)
 | 
					        item, data = self.GetSelectedItemData(um)
 | 
				
			||||||
        data.mdef[param] = value
 | 
					        data.mdef[param] = value
 | 
				
			||||||
 | 
					        # так как значение параметра изменилось,
 | 
				
			||||||
 | 
					        # то все субмодели должны быть пересчитаны
 | 
				
			||||||
        Walk(item)
 | 
					        Walk(item)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								trunk/plot.png
									
									
									
									
									
								
							
							
						
						
									
										
											BIN
										
									
								
								trunk/plot.png
									
									
									
									
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 15 KiB  | 
@@ -12,13 +12,11 @@
 | 
				
			|||||||
# -*- coding: UTF-8 -*-
 | 
					# -*- coding: UTF-8 -*-
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import os
 | 
					import os
 | 
				
			||||||
import sys
 | 
					 | 
				
			||||||
import json
 | 
					import json
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
import datetime
 | 
					import datetime
 | 
				
			||||||
import threading
 | 
					import threading
 | 
				
			||||||
import subprocess
 | 
					import subprocess
 | 
				
			||||||
import logging
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
import task
 | 
					import task
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -327,7 +325,7 @@ class Job:
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
#-------------------------------------------------------------------------------
 | 
					#-------------------------------------------------------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import time, random
 | 
					import random
 | 
				
			||||||
from pprint import pprint
 | 
					from pprint import pprint
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def main():
 | 
					def main():
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										
											BIN
										
									
								
								trunk/share/cursor-closedhand.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								trunk/share/cursor-closedhand.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 147 B  | 
							
								
								
									
										
											BIN
										
									
								
								trunk/share/cursor-openhand.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								trunk/share/cursor-openhand.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 928 B  | 
							
								
								
									
										
											BIN
										
									
								
								trunk/share/model-dup-tree.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								trunk/share/model-dup-tree.png
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| 
		 After Width: | Height: | Size: 535 B  | 
		Reference in New Issue
	
	Block a user