diff --git a/forms.py b/forms.py index 7ef7001..02a70a7 100644 --- a/forms.py +++ b/forms.py @@ -1,6 +1,5 @@ # -*- coding: utf-8 -*- -import sys import wx import wx.gizmos 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'), 'Add spacification to selected model') - tb1.AddSeparator() tb1.AddSimpleTool(ID_DUPLICATE_MODEL, "model-dup", wx.Bitmap('share/model-dup.png'), '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'), 'Delete selected model') tb1.AddSeparator() @@ -352,16 +352,29 @@ class SizeSelector(wx.Dialog): def GetValues(self): 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): def __init__(self, parent, title): wx.Frame.__init__ (self, parent, -1, title, size = wx.Size(600, 400)) 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.SetEnableGrid(True) self.plot.SetEnableAntiAliasing(True) self.plot.SetEnableHiRes(True) self.plot.SetEnableLegend(True) + self.plot.SetEnableDrag(True) self.Centre(wx.BOTH) @@ -371,6 +384,15 @@ class PlotFrame(wx.Frame): menubar.Append(menu, 'Plot') 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): def __init__(self, parent): diff --git a/opal.py b/opal.py index 6b0ca5a..73522e2 100644 --- a/opal.py +++ b/opal.py @@ -18,8 +18,6 @@ import wx.propgrid as wxpg import wx.lib.plot as wxplot import forms import time -import datetime -import os import threading import re 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.OnModelActivated) + self.OnModelSelected) self.m_user_models.Bind(wx.EVT_TREE_DELETE_ITEM, self.OnDeleteModelsItem) 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.SetSplitterLeft() - def OnModelActivated(self, event): + def OnModelSelected(self, event): item = event.GetItem() data = self.m_user_models.GetPyData(item) if data: @@ -474,6 +472,8 @@ class MainFrame(forms.MainFrame): param = prop.GetClientData() item, data = self.GetSelectedItemData(um) data.mdef[param] = value + # так как значение параметра изменилось, + # то все субмодели должны быть пересчитаны Walk(item) diff --git a/plot.png b/plot.png deleted file mode 100644 index 416591c..0000000 Binary files a/plot.png and /dev/null differ diff --git a/server.py b/server.py index 8b7c255..a16f73b 100644 --- a/server.py +++ b/server.py @@ -12,13 +12,11 @@ # -*- coding: UTF-8 -*- import os -import sys import json import time import datetime import threading import subprocess -import logging import task @@ -327,7 +325,7 @@ class Job: #------------------------------------------------------------------------------- -import time, random +import random from pprint import pprint def main(): diff --git a/share/cursor-closedhand.png b/share/cursor-closedhand.png new file mode 100644 index 0000000..b78dd1d Binary files /dev/null and b/share/cursor-closedhand.png differ diff --git a/share/cursor-openhand.png b/share/cursor-openhand.png new file mode 100644 index 0000000..d2b9078 Binary files /dev/null and b/share/cursor-openhand.png differ diff --git a/share/model-dup-tree.png b/share/model-dup-tree.png new file mode 100644 index 0000000..db45111 Binary files /dev/null and b/share/model-dup-tree.png differ