4
4
from odmtools .view .clsSource import clsSource
5
5
from odmtools .odmdata import Source
6
6
7
+
7
8
# Implementing clsSource
8
9
class frmCreateSource (clsSource ):
9
- def __init__ ( self , parent , service_man , prev_src ):
10
- clsSource .__init__ (self , parent )
11
- self .service_man = service_man
12
- self .prev = prev_src
13
- self .source = None
14
- self .series_service = self .service_man .get_series_service ()
15
-
16
-
17
- def getSource (self ):
18
- return self .source
19
-
10
+ def __init__ (self , parent , service_man , prev_src ):
11
+ clsSource .__init__ (self , parent )
12
+ self .service_man = service_man
13
+ self .prev = prev_src
14
+ self .source = None
15
+ self .series_service = self .service_man .get_series_service ()
20
16
21
- # Handlers for dlgCreateSource events.
22
- def onOkClick (self , event ):
23
- self .source = self .createSource ()
17
+ def getSource (self ):
18
+ return self .source
24
19
25
- if self .all_fields_full ():
26
- self .EndModal (wx .ID_OK )
27
- else :
28
- wx .MessageDialog (None , "Source was not created, A Value is missing" , " " , wx .OK ).ShowModal ()
20
+ # Handlers for dlgCreateSource events.
21
+ def onOkClick (self , event ):
22
+ self .source = self .createSource ()
29
23
30
- def all_fields_full (self ):
31
- return (self .txtOrg .GetValue () is not None ) and \
32
- (self .txtDescrip .GetValue () <> '' ) and \
33
- (self .txtLink .GetValue () is not None ) and \
34
- (self .txtName .GetValue () is not None ) and \
35
- (self .txtPhone .GetValue () is not None ) and \
36
- (self .txtEmail .GetValue () is not None ) and \
37
- (self .txtAddress .GetValue () is not None ) and \
38
- (self .txtCity .GetValue () is not None ) and \
39
- (self .txtState .GetValue () <> '' ) and \
40
- (self .txtZip .GetValue () is not None ) and \
41
- (self .txtCitation .GetValue () <> '' )
24
+ if self .all_fields_full ():
25
+ self .EndModal (wx .ID_OK )
26
+ else :
27
+ wx .MessageDialog (None , "Source was not created, A Value is missing" , " " , wx .OK ).ShowModal ()
42
28
43
- def createSource (self ):
44
- s = Source ()
29
+ def all_fields_full (self ):
30
+ return (self .txtOrg .GetValue () is not None ) and \
31
+ (self .txtDescrip .GetValue () != '' ) and \
32
+ (self .txtLink .GetValue () is not None ) and \
33
+ (self .txtName .GetValue () is not None ) and \
34
+ (self .txtPhone .GetValue () is not None ) and \
35
+ (self .txtEmail .GetValue () is not None ) and \
36
+ (self .txtAddress .GetValue () is not None ) and \
37
+ (self .txtCity .GetValue () is not None ) and \
38
+ (self .txtState .GetValue () != '' ) and \
39
+ (self .txtZip .GetValue () is not None ) and \
40
+ (self .txtCitation .GetValue () != '' )
45
41
46
- s .organization = self .txtOrg .GetValue () if self .txtOrg .GetValue () <> u'' else None
47
- s .description = self .txtDescrip .GetValue () if self .txtDescrip .GetValue () <> u'' else None
48
- s .link = self .txtLink .GetValue () if self .txtLink .GetValue () <> u'' else None
42
+ def createSource (self ):
43
+ s = Source ()
49
44
50
- s . contact_name = self .txtName .GetValue () if self .txtName .GetValue () <> u'' else None
51
- s . phone = self .txtPhone .GetValue () if self .txtPhone .GetValue () <> u'' else None
52
- s . email = self .txtEmail .GetValue () if self .txtEmail .GetValue () <> u'' else None
45
+ s . organization = self .txtOrg .GetValue () if self .txtOrg .GetValue () != u'' else None
46
+ s . description = self .txtDescrip .GetValue () if self .txtDescrip .GetValue () != u'' else None
47
+ s . link = self .txtLink .GetValue () if self .txtLink .GetValue () != u'' else None
53
48
54
- s .address = self .txtAddress .GetValue () if self .txtAddress .GetValue () <> u'' else None
55
- s .city = self .txtCity .GetValue () if self .txtCity .GetValue () <> u'' else None
56
- s .state = self .txtState .GetValue () if self .txtState .GetValue () <> u'' else None
57
- s .zip_code = self .txtZip .GetValue () if self .txtZip .GetValue () <> u'' else None
49
+ s .contact_name = self .txtName .GetValue () if self .txtName .GetValue () != u'' else None
50
+ s .phone = self .txtPhone .GetValue () if self .txtPhone .GetValue () != u'' else None
51
+ s .email = self .txtEmail .GetValue () if self .txtEmail .GetValue () != u'' else None
58
52
59
- s . citation = self .txtCitation .GetValue () if self .txtCitation .GetValue () <> u'' else None
60
- # s.metadata_id = self.chMeta .GetValue() if self.chMeta .GetValue() <> u'' else 0
61
- s . iso_metadata_id = 0
62
- return s
53
+ s . address = self .txtAddress .GetValue () if self .txtAddress .GetValue () != u'' else None
54
+ s . city = self .txtCity .GetValue () if self .txtCity .GetValue () != u'' else None
55
+ s . state = self . txtState . GetValue () if self . txtState . GetValue () != u'' else None
56
+ s . zip_code = self . txtZip . GetValue () if self . txtZip . GetValue () != u'' else None
63
57
58
+ s .citation = self .txtCitation .GetValue () if self .txtCitation .GetValue () != u'' else None
59
+ # s.metadata_id = self.chMeta.GetValue() if self.chMeta.GetValue() != u'' else 0
60
+ s .iso_metadata_id = 0
61
+ return s
64
62
65
- def onCancelClick (self , event ):
66
- # TODO: Implement onCancelClick
67
- self .EndModal (wx .ID_CANCEL )
63
+ def onCancelClick (self , event ):
64
+ # TODO: Implement onCancelClick
65
+ self .EndModal (wx .ID_CANCEL )
0 commit comments