def __init__(self, hc, watching):
super(DosePopupMenu, self).__init__()<EOL>menu_items = [("<STR_LIT>", hc.on_flip),<EOL>(None, None),<EOL>]<EOL>if watching:<EOL><INDENT>menu_items.extend([("<STR_LIT>", hc.on_stop),<EOL>(None, None),<EOL>("<STR_LIT>", hc.on_red),<EOL>("<STR_LIT>", hc.on_yellow),<EOL>("<STR_LIT>", hc.on_green),<EOL>])<EOL><DEDENT>else:<EOL><INDENT>menu_items.extend([("<STR_LIT>", hc.on_start),<EOL>(None, None),<EOL>("<STR_LIT>", hc.on_directory_to_watch),<EOL>("<STR_LIT>", hc.on_define_call_string),<EOL>("<STR_LIT>", hc.on_skip_pattern),<EOL>])<EOL><DEDENT>menu_items.extend([(None, None),<EOL>("<STR_LIT>", hc.on_close),<EOL>(None, None),<EOL>("<STR_LIT>", hc.on_about),<EOL>("<STR_LIT>", hc.on_help),<EOL>])<EOL>for txt, callback in menu_items:<EOL><INDENT>if txt is None:<EOL><INDENT>self.AppendSeparator()<EOL><DEDENT>else:<EOL><INDENT>item = wx.MenuItem(self, wx.ID_ANY, txt)<EOL>self.Append(item)<EOL>self.Bind(wx.EVT_MENU, callback, item)<EOL><DEDENT><DEDENT>
Dose pop-up menu widget constructor
The "hc" (handler class) parameter should be a class with all the needed
callback methods.