<commit_before>from PyQt4.QtGui import *
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _


import datetime
from electrum.util import format_satoshis
from electrum.bitcoin import COIN

try:
    import matplotlib.pyplot as plt
    import matplotlib.dates as md
    from matplotlib.patches import Ellipse
    from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, DrawingArea, HPacker
    flag_matlib=True
except:
    flag_matlib=False





class Plugin(BasePlugin):

    def is_available(self):
        if flag_matlib:
            return True
        else:
            return False

    @hook
    def init_qt(self, gui):
        self.win = gui.main_window

    @hook
    def export_history_dialog(self, d,hbox):
        self.wallet = d.wallet
        history = self.wallet.get_history()
        if len(history) > 0:
            b = QPushButton(_("Preview plot"))
            hbox.addWidget(b)
            b.clicked.connect(lambda: self.do_plot(self.wallet, history))
        else:
            b = QPushButton(_("No history to plot"))<commit_msg>Plot plugin for multiple windows.<commit_after>from PyQt4.QtGui import *
from electrum.plugins import BasePlugin, hook
from electrum.i18n import _


import datetime
from electrum.util import format_satoshis
from electrum.bitcoin import COIN

try:
    import matplotlib.pyplot as plt
    import matplotlib.dates as md
    from matplotlib.patches import Ellipse
    from matplotlib.offsetbox import AnchoredOffsetbox, TextArea, DrawingArea, HPacker
    flag_matlib=True
except:
    flag_matlib=False


class Plugin(BasePlugin):

    def is_available(self):
        if flag_matlib:
            return True
        else:
            return False

    @hook
    def export_history_dialog(self, window, hbox):
        wallet = window.wallet
        history = wallet.get_history()
        if len(history) > 0:
            b = QPushButton(_("Preview plot"))
            hbox.addWidget(b)
            b.clicked.connect(lambda: self.do_plot(wallet, history))
        else:
            b = QPushButton(_("No history to plot"))
{'fraction_non_alphanumeric': 0.0746054519368723, 'fraction_numerical': 0.003825920612147298, 'mean_word_length': 2.702654867256637, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3573574', 'n_tokens_mistral': 641, 'n_tokens_neox': 626, 'n_words': 168}