Ejemplo n.º 1
0
 def __init__(self, parent, treeViewInstance):
     self._treeViewInstance= treeViewInstance
     self.mavlinkReceiver=mavlink_receiver.MAVlinkReceiver(threading=False)
     self._parent = parent
     self.running=True
     self.lastTreeUpdate=time.time()
     self.treeUpdateFrequency=5.0
     self.t = QtCore.QTimer()
     self.t.timeout.connect(self.update)
     self.t.start(5)
     self.mainDataRange=[-200, 0]
     self.plugin_manager=plugins.plugin_manager(self.plugin_callback,  self.mainDataRange)
     self.timelinePlot = None
Ejemplo n.º 2
0
 def __init__(self, parent, treeViewInstance):
     self._treeViewInstance = treeViewInstance
     self.mavlinkReceiver = mavlink_receiver.MAVlinkReceiver(
         threading=False)
     self._parent = parent
     self.running = True
     self.lastTreeUpdate = time.time()
     self.treeUpdateFrequency = 5.0
     self.t = QtCore.QTimer()
     self.t.timeout.connect(self.update)
     self.t.start(5)
     self.mainDataRange = [-200, 0]
     self.plugin_manager = plugins.plugin_manager(self.plugin_callback,
                                                  self.mainDataRange)
     self.timelinePlot = None
Ejemplo n.º 3
0
 def reloadPlugins(self):
     global plugins
     reload(plugins)
     import plugins
     self.plugin_manager=plugins.plugin_manager(self.plugin_callback)
Ejemplo n.º 4
0
# Handle arguments.
if args.config:
    config_dir = args.config
else:
    path_obj = path.path()
    path_obj.fromstr(os.getcwd())
    path_obj.add(".pybot")
    config_dir = path_obj.tostr()

# Initialize the config system, and read the config.
config_obj = config.config()
config_obj.config_dir = config_dir
config_obj.read_config("main.conf")

# Initialize the plugin system, and load plugins.
plugin_obj = plugins.plugin_manager(config_obj)
plugin_obj.load_plugins()

# Initialize the bot.
try:
    client = bot.Bot(nickname=config_obj.nick, realname=config_obj.name)
    # Pass on our plugin_manager instance, config instance, and the channel list.
    client.plugin = plugin_obj
    client.config = config_obj
    # Connect the bot.
    client.sasl_password = config_obj.sasl_password
    client.sasl_username = config_obj.sasl_username
    client.connect(config_obj.server, config_obj.port, tls=config_obj.ssl)
    # Go into a infinite event loop. (This never returns unless an exception is thrown.)
    client.handle_forever()
except KeyboardInterrupt:
Ejemplo n.º 5
0
 def reloadPlugins(self):
     global plugins
     reload(plugins)
     import plugins
     self.plugin_manager = plugins.plugin_manager(self.plugin_callback)
Ejemplo n.º 6
0
    def __init__(self):
        logger = logging.getLogger('INIT')
        self.uimanager = gtk.UIManager()
        self.window = gtk.Window(gtk.WINDOW_TOPLEVEL)
        gtk.window_set_default_icon_from_file(IMGDIR + "icon.png")
        self.window.set_size_request(490, 420)
        self.window.set_title("leo-lookup Version " + self.__version__)
        self.window.connect("destroy", self.destroyWin)

        self.box = gtk.VBox(False, 5)

        self.menubar_acts = [('File', None, "_File"),
                             ('Quit', gtk.STOCK_QUIT, "_Quit", None,
                              "Close Program", self.destroyWin),
                             ('Extensions', None, "_Extensions"),
                             ('ext_prefs', None, "_Preferences", None,
                              "Set prefereences for extensions", None),
                             ('Help', None, "_Help"),
                             ('aboutdlg', None, "_About", None,
                              "View informations about leo-lookup.", None)]

        self.actgroup = gtk.ActionGroup("LEO_LOOKUP")
        self.actgroup.add_actions(self.menubar_acts)

        accelgroup = self.uimanager.get_accel_group()
        self.window.add_accel_group(accelgroup)
        self.uimanager.add_ui_from_string(self.menubardesc)
        self.uimanager.insert_action_group(self.actgroup, 0)
        self.menubar = self.uimanager.get_widget("/Mainmenu")
        self.box.pack_start(self.menubar, False)

        self.word2lookup = gtk.Entry()
        self.word2lookup.set_text("Enter word to lookup here ...")
        self.box.pack_start(self.word2lookup, False, False, 0)

        self.box2 = gtk.HBox(False, 6)

        self.fromLangLabel = gtk.Label("From ")
        self.box2.pack_start(self.fromLangLabel, False, False, 0)

        # Create combo box for the language to translate from
        self.lstst_fromLang = gtk.ListStore(gtk.gdk.Pixbuf, str)
        self.fromLang = gtk.ComboBox(self.lstst_fromLang)
        cellpb = gtk.CellRendererPixbuf()
        cellt = gtk.CellRendererText()
        self.fromLang.pack_start(cellpb, True)
        self.fromLang.pack_start(cellt, True)
        self.fromLang.add_attribute(cellpb, 'pixbuf', 0)
        self.fromLang.add_attribute(cellt, 'text', 1)

        # add languages to combobox
        for lang in self.supportedLangs:
            self.lstst_fromLang.append(
                [gtk.gdk.pixbuf_new_from_file(IMGDIR + lang + ".png"), lang])
        self.fromLang.set_active(0)
        self.box2.pack_start(self.fromLang, False, False, 0)

        self.swapToFrom = gtk.Button("<>")
        self.swapToFrom.connect("clicked", self.swapToFromClicked)
        self.box2.pack_start(self.swapToFrom, False, False, 0)

        self.toLangLabel = gtk.Label("to ")
        self.box2.pack_start(self.toLangLabel, False, False, 0)

        # Create combo box for the language to translate to
        self.lstst_toLang = gtk.ListStore(gtk.gdk.Pixbuf, str)
        self.toLang = gtk.ComboBox(self.lstst_toLang)
        self.toLang.pack_start(cellpb, True)
        self.toLang.pack_start(cellt, True)
        self.toLang.add_attribute(cellpb, 'pixbuf', 0)
        self.toLang.add_attribute(cellt, 'text', 1)
        for lang in self.supportedLangs:
            self.lstst_toLang.append(
                [gtk.gdk.pixbuf_new_from_file(IMGDIR + lang + ".png"), lang])
        self.toLang.set_active(1)

        self.box2.pack_start(self.toLang, False, False, 0)

        # Create indicator of successes
        self.results = gtk.Label("")
        self.box2.pack_end(self.results, False, False, 0)

        self.box.pack_start(self.box2, False, False, 0)

        self.lookup = gtk.Button("Look up!")
        self.lookup.connect("clicked", self.onTransClick)
        self.box.pack_start(self.lookup, False, False, 0)

        self.scrollcont = gtk.ScrolledWindow()
        self.scrollcont.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)

        self.meanings = gtk.ListStore(str, str)
        self.listOfMeanings = gtk.TreeView(self.meanings)
        self.listOfMeaningsCol = gtk.TreeViewColumn("Foreign Lang.")
        self.listOfMeanings.append_column(self.listOfMeaningsCol)
        cell = gtk.CellRendererText()
        self.listOfMeaningsCol.pack_start(cell, True)
        self.listOfMeaningsCol.add_attribute(cell, 'text', 0)

        self.listOfMeaningsCol2 = gtk.TreeViewColumn("Familiar Lang.")
        self.listOfMeanings.append_column(self.listOfMeaningsCol2)
        cell2 = gtk.CellRendererText()
        self.listOfMeaningsCol2.pack_start(cell2, True)
        self.listOfMeaningsCol2.add_attribute(cell2, 'text', 1)

        self.lom_treesel = self.listOfMeanings.get_selection()
        self.lom_treesel.set_mode(gtk.SELECTION_MULTIPLE)

        self.scrollcont.add(self.listOfMeanings)
        self.box.pack_start(self.scrollcont, True, True, 0)

        self.box.show_all()

        self.window.add(self.box)
        logger.info("window constructed, let's make it visible ...")
        self.window.show_all()

        logger.info("initializing plugin architecture ...")
        pm = plugins.plugin_manager(self.uimanager, self.lom_treesel,
                                    PLUGINDIR)
        pm.load_plugins()
        gtk.main()