Esempio n. 1
0
    def __init__(self,
                 parent,
                 size=None,
                 defaultsize=(420, 380),
                 name="",
                 caption=None,
                 **kwargs):

        # be sure to have a caption
        if caption is None:
            caption = name
        kwargs['name'] = name

        # use defaultsize if no size
        if size is None:
            size = defaultsize
        else:
            kwargs['size'] = size
        kwargs['defaultsize'] = defaultsize

        # init
        wx.Dialog.__init__(self, parent, -1, caption, style = wx.TAB_TRAVERSAL | wx.DEFAULT_DIALOG_STYLE, size = size)

        # container
        self.m_html = wxUrlClickHtmlWindow(self, -1, style = wx.CLIP_CHILDREN | wx.html.HW_SCROLLBAR_NEVER | wx.TAB_TRAVERSAL)
        EVT_HTML_URL_CLICK(self.m_html, self.OnLinkClick)

        # set the content
        apply(self.SetContents,(),kwargs)

        # layout the content
        self.SetAutoLayout(True)

        lc = wx.LayoutConstraints()
        lc.top.SameAs(self, wx.Top, 5)
        lc.left.SameAs(self, wx.Left, 5)
        lc.bottom.SameAs(self, wx.Bottom, 5)
        lc.right.SameAs(self, wx.Right, 5)
        self.m_html.SetConstraints(lc)
        self.Layout()

        self.GetDefaultItem().SetFocus()

        # from wxWindows docs: This function (wxWindow::OnCharHook) is
        # only relevant to top-level windows (frames and dialogs), and
        # under Windows only. Under GTK the normal EVT_CHAR_ event has
        # the functionality, i.e. you can intercepts it and if you
        # don't call wxEvent::Skip the window won't get the event.

        if sys.platform not in ["windows","nt"]:
            wx.EVT_CHAR_HOOK(self,self.OnCharHook)
        else:
            wx.EVT_CHAR(self,self.OnCharHook)
Esempio n. 2
0
 def __init__(self, *args, **kwds):
     D.__init__(self, *args, **kwds)
     wx.EVT_CHAR_HOOK(self, self.onKey)
     self.configobj = {}
     self.field_keys = [
         'mcode', 'ccode', 'dde1_server', 'dde1_topic', 'dde1_time',
         'dde1_price', 'dde1_volume', 'dde2_server', 'dde2_topic',
         'dde2_time', 'dde2_price', 'dde2_volume'
     ] + SUPPORT_TIME
     self.require_fields = [
         'dde1_server', 'dde1_topic', 'dde1_time', 'dde1_price',
         'dde1_volume'
     ]
Esempio n. 3
0
 def __init__(self, *args, **kwds):
     M.__init__(self, *args, **kwds)
     wx.EVT_CHAR_HOOK(self, self.onKey)
     self.field_keys = [
         'mname', 'mcode', 'mtimezone', 'mclear', 's1_start', 's1_end',
         's2_start', 's2_end', 'd0', 'd1', 'd2', 'd3', 'd4', 'd5', 'd6'
     ]
     self.require_fields = [
         'mname', 'mcode', 'mtimezone', 'mclear', 's1_start', 's1_end'
     ]
     self.inifile = market_ini
     self.configobj = {}
     self.loaddata()
     self.mtimezone.SetItems(timezones)
Esempio n. 4
0
 def __init__(self, *args, **kwds):
     C.__init__(self, *args, **kwds)
     wx.EVT_CHAR_HOOK(self, self.onKey)
     self.field_keys = [
         'cname', 'ccode', 'mcode', 'cpov', 'csource', 'cdir'
     ]
     self.require_fields = ['cname', 'ccode', 'mcode']
     self.inifile = commodity_ini
     self.configobj = {}
     self.m_obj = ConfigObj(market_ini, encoding='utf-8')
     self.markets = [(v.get('mname'), v.get('mcode'))
                     for k, v in self.m_obj.items()]
     self.loaddata()
     self.csource.SetItems(QUOTE_SOURCE)
     self.mcode.SetItems([mcode for mname, mcode in self.markets])
Esempio n. 5
0
 def __init__(self, *args, **kwds):
     S.__init__(self, *args, **kwds)
     wx.EVT_CHAR_HOOK(self, self.onKey)
     self.configobj = {}
     self.inifile = strategy_ini
     self.configobj = {}
     self.c_obj = ConfigObj(commodity_ini, encoding='utf-8')
     self.field_keys = [
         'strategyfile', 'historyfile', 'ccode', 'period', 'num', 'cost',
         'start', 'end', 'sid', 'run'
     ]
     self.require_fields = ['strategyfile', 'ccode', 'period', 'num']
     self.ccode.SetItems([v.get('ccode') for k, v in self.c_obj.items()])
     self.period.SetItems(SUPPORT_TIME_NAME)
     self.loaddata()