Beispiel #1
0
 def __init__(self, **kw):
     kw = KwStruct(kw,
         name = "",
         filename = "",
         basename = "",      # basename of filename
         absname = "",       # absolute filename
         # implicit
         index = -1,
         error = 0,          # error while loading this resource
     )
     Struct.__init__(self, **kw.getKw())
Beispiel #2
0
 def __init__(self, parent, ex, title="Error", **kw):
     kw = KwStruct(kw, bitmap="error")
     text = str(kw.get("text", ""))
     if text and text[-1] != "\n":
         text = text + "\n"
     text = text + "\n"
     if isinstance(ex, EnvironmentError) and ex.filename is not None:
         t = "[Errno %s] %s:\n%s" % (ex.errno, ex.strerror, repr(
             ex.filename))
     else:
         t = str(ex)
     kw.text = text + t
     apply(MfxDialog.__init__, (self, parent, title), kw.getKw())
Beispiel #3
0
 def initKw(self, kw):
     kw = KwStruct(
         kw,
         timeout=0,
         resizable=0,
         text="",
         justify="center",
         strings=("OK", ),
         default=0,
         width=0,
         font=self.getDefaultFont(),
         buttonfont=self.getDefaultFont(),
         padx=20,
         pady=20,
         bitmap=None,
         bitmap_side="left",
         bitmap_padx=10,
         bitmap_pady=20,
         image=None,
         image_side="left",
         image_padx=10,
         image_pady=20,
     )
     # default to separator if more than one button
     sw = 2 * (len(kw.strings) > 1)
     kwdefault(kw.__dict__, separatorwidth=sw)
     return kw
Beispiel #4
0
 def initKw(self, kw):
     kw = KwStruct(
         kw,
         strings=("OK", "Cancel"),
         default=0,
         separatorwidth=0,
     )
     return MfxDialog.initKw(self, kw)
Beispiel #5
0
 def __init__(self, **kw):
     # start with all fields from CardsetConfig
     config = CardsetConfig()
     kw = KwStruct(config.__dict__, **kw)
     # si is the SelectionInfo struct that will be queried by
     # the "select cardset" dialogs. It can be freely modified.
     si = Struct(type=0, size=0, styles=[], nationalities=[], dates=[])
     kw = KwStruct(kw,
         # essentials
         ranks = (),
         suits = (),
         trumps = (),
         nbottoms = 7,
         nletters = 4,
         nshadows = 1 + 13,
         # selection criterias
         si = si,
         # implicit
         backname = None,
         dir = "",
     )
     Resource.__init__(self, **kw.getKw())