1
+ # -*- coding: utf-8 -*-
2
+ # ***************************************************************************
3
+ # * *
4
+ # * This program is free software: you can redistribute it and/or modify *
5
+ # * it under the terms of the GNU General Public License as published by *
6
+ # * the Free Software Foundation, either version 3 of the License, or *
7
+ # * (at your option) any later version. *
8
+ # * *
9
+ # * This program is distributed in the hope that it will be useful, *
10
+ # * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11
+ # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12
+ # * GNU General Public License for more details. *
13
+ # * *
14
+ # * You should have received a copy of the GNU General Public License *
15
+ # * along with this program. If not, see <http://www.gnu.org/licenses/>. *
16
+ # * *
17
+ # ***************************************************************************
18
+
19
+ from pygears import __version__
20
+ import os
21
+
22
+ class ViewProviderGearConnector (object ):
23
+ def __init__ (self , vobj , icon_fn = None ):
24
+ # Set this object to the proxy object of the actual view provider
25
+ vobj .Proxy = self
26
+ dirname = os .path .dirname (__file__ )
27
+ self .icon_fn = icon_fn or os .path .join (dirname , "icons" , "gearconnector.svg" )
28
+
29
+ def attach (self , vobj ):
30
+ self .vobj = vobj
31
+
32
+ def getIcon (self ):
33
+ return self .icon_fn
34
+
35
+ def claimChildren (self ):
36
+ return [self .vobj .Object .master_gear , self .vobj .Object .slave_gear ]
37
+
38
+ def __getstate__ (self ):
39
+ return {"icon_fn" : self .icon_fn }
40
+
41
+ def __setstate__ (self , state ):
42
+ self .icon_fn = state ["icon_fn" ]
43
+
44
+
45
+ class GearConnector (object ):
46
+ def __init__ (self , obj , master_gear , slave_gear ):
47
+ obj .addProperty ("App::PropertyString" , "version" , "version" , "freecad.gears-version" , 1 )
48
+ obj .addProperty ("App::PropertyLink" ,"master_gear" ,"gear" ,"master gear" , 1 )
49
+ obj .addProperty ("App::PropertyLink" ,"slave_gear" ,"gear" ,"slave gear" , 1 )
50
+ obj .version = __version__
51
+ obj .master_gear = master_gear
52
+ obj .slave_gear = slave_gear
53
+
54
+ def execute (self , fp ):
55
+ pass
0 commit comments