Python copy to clipboard

53 Python code examples are found related to " copy to clipboard". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: mplutil.py    From netharn with Apache License 2.0 6 votes vote down vote up
def copy_figure_to_clipboard(fig):
    """
    References:
        https://stackoverflow.com/questions/17676373/python-matplotlib-pyqt-copy-image-to-clipboard
    """
    print('Copying figure %d to the clipboard' % fig.number)
    import matplotlib as mpl
    app = mpl.backends.backend_qt5.qApp
    QtGui = mpl.backends.backend_qt5.QtGui
    im_bgra = render_figure_to_image(fig, transparent=True)
    im_rgba = cv2.cvtColor(im_bgra, cv2.COLOR_BGRA2RGBA)
    im = im_rgba
    QImage = QtGui.QImage
    qim = QImage(im.data, im.shape[1], im.shape[0], im.strides[0], QImage.Format_RGBA8888)
    clipboard = app.clipboard()
    clipboard.setImage(qim)

    # size = fig.canvas.size()
    # width, height = size.width(), size.height()
    # qim = QtGui.QImage(fig.canvas.buffer_rgba(), width, height, QtGui.QImage.Format_ARGB32)

    # QtWidgets = mpl.backends.backend_qt5.QtWidgets
    # pixmap = QtWidgets.QWidget.grab(fig.canvas)
    # clipboard.setPixmap(pixmap) 
Example 2
Source File: utils.py    From Dwarf with GNU General Public License v3.0 6 votes vote down vote up
def copy_hex_to_clipboard(hex_str):
    """ Helper for copying hexstr in prefered style
    """
    from dwarf_debugger.lib.prefs import Prefs
    _prefs = Prefs()
    uppercase = (_prefs.get('dwarf_ui_hexstyle', 'upper').lower() == 'upper')
    if isinstance(hex_str, str):
        if hex_str.startswith('0x'):
            if uppercase:
                hex_str = hex_str.upper().replace('0X', '0x')
            else:
                hex_str = hex_str.lower()

            pyperclip.copy(hex_str)
    elif isinstance(hex_str, int):
        str_fmt = '0x{0:x}'
        if uppercase:
            str_fmt = '0x{0:X}'

        pyperclip.copy(str_fmt.format(hex_str)) 
Example 3
Source File: page.py    From ttrv with MIT License 6 votes vote down vote up
def copy_to_clipboard(self, url):
        """
        Attempt to copy the selected URL to the user's clipboard
        """
        if url is None:
            self.term.flash()
            return

        try:
            clipboard_copy(url)
        except (ProgramError, OSError) as e:
            _logger.exception(e)
            self.term.show_notification(
                'Failed to copy url: {0}'.format(e))
        else:
            self.term.show_notification(
                ['Copied to clipboard:', url], timeout=1) 
Example 4
Source File: winclipboard.py    From SwiftKitten with MIT License 6 votes vote down vote up
def CopyToClipboard(string):
    '''
        use win32 api to copy `string` to the clipboard
    '''
    hWnd = lib.GetConsoleWindow()
  
    if lib.OpenClipboard(hWnd):
        cstring = ffi.new("char[]", string)
        size = ffi.sizeof(cstring)
        
        # make it a moveable memory for other processes
        hGlobal = lib.GlobalAlloc(lib.GMEM_MOVEABLE, size)
        buffer = lib.GlobalLock(hGlobal)
        lib.memcpy(buffer, cstring, size)
        lib.GlobalUnlock(hGlobal)
        
        res = lib.EmptyClipboard()
        res = lib.SetClipboardData(lib.CF_TEXT, buffer)
 
        lib.CloseClipboard() 
Example 5
Source File: DebugVariablePanel.py    From OpenPLC_Editor with GNU General Public License v3.0 6 votes vote down vote up
def CopyDataToClipboard(self, variables):
        text = "tick;%s;\n" % ";".join([item.GetVariable() for item, data in variables])
        next_tick = NextTick(variables)
        while next_tick is not None:
            values = []
            for item, data in variables:
                if len(data) > 0:
                    if next_tick == data[0][0]:
                        var_type = item.GetVariableType()
                        if var_type in ["STRING", "WSTRING"]:
                            value = item.GetRawValue(int(data.pop(0)[2]))
                            if var_type == "STRING":
                                values.append("'%s'" % value)
                            else:
                                values.append('"%s"' % value)
                        else:
                            values.append("%.3f" % data.pop(0)[1])
                    else:
                        values.append("")
                else:
                    values.append("")
            text += "%d;%s;\n" % (next_tick, ";".join(values))
            next_tick = NextTick(variables)
        self.ParentWindow.SetCopyBuffer(text) 
Example 6
Source File: _pylab_tweaks.py    From spinmob with GNU General Public License v3.0 6 votes vote down vote up
def copy_figure_to_clipboard(figure='gcf'):
    """
    Copies the specified figure to the system clipboard. Specifying 'gcf'
    will use the current figure.
    """    
    try:
        import pyqtgraph as _p
    
        # Get the current figure if necessary        
        if figure is 'gcf': figure = _s.pylab.gcf() 
        
        # Store the figure as an image
        path = _os.path.join(_s.settings.path_home, "clipboard.png")
        figure.savefig(path)
        
        # Set the clipboard. I know, it's weird to use pyqtgraph, but 
        # This covers both Qt4 and Qt5 with their Qt4 wrapper!
        _p.QtGui.QApplication.instance().clipboard().setImage(_p.QtGui.QImage(path))
        
    except:         
        print("This function currently requires pyqtgraph to be installed.") 
Example 7
Source File: utils.py    From Dwarf with GNU General Public License v3.0 5 votes vote down vote up
def copy_str_to_clipboard(text):
    """ Helper for copying text
    """
    if isinstance(text, str):
        pyperclip.copy(text) 
Example 8
Source File: backend_wx.py    From ImageFusion with MIT License 5 votes vote down vote up
def Copy_to_Clipboard(self, event=None):
        "copy bitmap of canvas to system clipboard"
        bmp_obj = wx.BitmapDataObject()
        bmp_obj.SetBitmap(self.bitmap)

        if not wx.TheClipboard.IsOpened():
           open_success = wx.TheClipboard.Open()
           if open_success:
              wx.TheClipboard.SetData(bmp_obj)
              wx.TheClipboard.Close()
              wx.TheClipboard.Flush() 
Example 9
Source File: app.py    From liquid-swap with GNU General Public License v3.0 5 votes vote down vote up
def copy_to_clipboard(text):
    # TODO: test in different os
    cb = QApplication.clipboard()
    cb.clear(mode=cb.Clipboard)
    cb.setText(text, mode=cb.Clipboard) 
Example 10
Source File: lineobj.py    From malkit with MIT License 5 votes vote down vote up
def copy_selection_to_clipboard(self): # ()
        '''Copy the text in the region to the windows clipboard.'''
        if self.enable_win32_clipboard and self.enable_selection and self.selection_mark >= 0:
                selection_mark = min(self.selection_mark,len(self.line_buffer))
                cursor = min(self.point,len(self.line_buffer))
                if self.selection_mark == -1:
                        return
                begin = min(cursor, selection_mark)
                end = max(cursor, selection_mark)
                toclipboard = "".join(self.line_buffer[begin:end])
                clipboard.SetClipboardText(toclipboard) 
Example 11
Source File: lineobj.py    From malkit with MIT License 5 votes vote down vote up
def copy_region_to_clipboard(self): # ()
        '''Copy the text in the region to the windows clipboard.'''
        if self.enable_win32_clipboard:
                mark = min(self.mark, len(self.line_buffer))
                cursor = min(self.point, len(self.line_buffer))
                if self.mark == -1:
                        return
                begin = min(cursor, mark)
                end = max(cursor, mark)
                toclipboard = "".join(self.line_buffer[begin:end])
                clipboard.SetClipboardText(toclipboard) 
Example 12
Source File: message_box.py    From vise with GNU General Public License v3.0 5 votes vote down vote up
def copy_to_clipboard(self, *args):
        QApplication.clipboard().setText(
            '%s, version %s\n%s: %s\n\n%s' %
            (appname, str_version, self.windowTitle(),
             self.msg.text(),
             self.det_msg.toPlainText()))
        if hasattr(self, 'ctc_button'):
            self.ctc_button.setText(_('Copied')) 
Example 13
Source File: misc_utils.py    From thonny with MIT License 5 votes vote down vote up
def copy_to_clipboard(data):
    if running_on_windows():
        return _copy_to_windows_clipboard(data)
    elif running_on_mac_os():
        command = ["pbcopy"]
    else:
        command = ["xsel", "-b", "-i"]

    env = dict(os.environ).copy()
    encoding = "utf-8"
    env["PYTHONIOENCODING"] = encoding

    if sys.version_info >= (3, 6):
        extra = {"encoding": encoding}
    else:
        extra = {}

    proc = subprocess.Popen(
        command,
        stdin=subprocess.PIPE,
        shell=False,
        env=env,
        universal_newlines=True,
        close_fds=True,
        **extra
    )
    proc.communicate(input=data, timeout=0.1) 
Example 14
Source File: core.py    From deen with Apache License 2.0 5 votes vote down vote up
def copy_content_to_clipboard(self):
        focussed_widget = QApplication.focusWidget()
        parent_encoder = self.get_parent_encoder(focussed_widget)
        if not parent_encoder._content:
            return
        try:
            content = parent_encoder._content.decode('utf8')
        except UnicodeDecodeError as e:
            parent_encoder.log.error('Cannot copy non-ASCII content to clipboard')
            parent_encoder.log.debug(e, exc_info=True)
            return
        clipboard = QApplication.clipboard()
        clipboard.setText(content) 
Example 15
Source File: lineobj.py    From OWASP-ZSC with GNU General Public License v3.0 5 votes vote down vote up
def copy_selection_to_clipboard(self):  # ()
        '''Copy the text in the region to the windows clipboard.'''
        if self.enable_win32_clipboard and self.enable_selection and self.selection_mark >= 0:
            selection_mark = min(self.selection_mark, len(self.line_buffer))
            cursor = min(self.point, len(self.line_buffer))
            if self.selection_mark == -1:
                return
            begin = min(cursor, selection_mark)
            end = max(cursor, selection_mark)
            toclipboard = "".join(self.line_buffer[begin:end])
            clipboard.SetClipboardText(toclipboard) 
Example 16
Source File: lineobj.py    From OWASP-ZSC with GNU General Public License v3.0 5 votes vote down vote up
def copy_region_to_clipboard(self):  # ()
        '''Copy the text in the region to the windows clipboard.'''
        if self.enable_win32_clipboard:
            mark = min(self.mark, len(self.line_buffer))
            cursor = min(self.point, len(self.line_buffer))
            if self.mark == -1:
                return
            begin = min(cursor, mark)
            end = max(cursor, mark)
            toclipboard = "".join(self.line_buffer[begin:end])
            clipboard.SetClipboardText(toclipboard) 
Example 17
Source File: backend_wx.py    From coffeegrindsize with MIT License 5 votes vote down vote up
def Copy_to_Clipboard(self, event=None):
        "copy bitmap of canvas to system clipboard"
        bmp_obj = wx.BitmapDataObject()
        bmp_obj.SetBitmap(self.bitmap)

        if not wx.TheClipboard.IsOpened():
            open_success = wx.TheClipboard.Open()
            if open_success:
                wx.TheClipboard.SetData(bmp_obj)
                wx.TheClipboard.Close()
                wx.TheClipboard.Flush() 
Example 18
Source File: SideBar.py    From SideBarTools with MIT License 5 votes vote down vote up
def copy_to_clipboard_and_inform(self, data):
        sublime.set_clipboard(data)
        lines = len(data.split('\n'))
        self.window.status_message('Copied {} to clipboard'.format(
            '{} lines'.format(lines) if lines > 1 else '"{}"'.format(data)
        )) 
Example 19
Source File: main_window.py    From Apostrophe with GNU General Public License v3.0 5 votes vote down vote up
def copy_html_to_clipboard(self, _widget=None, _date=None):
        """Copies only html without headers etc. to Clipboard
        """

        output = helpers.pandoc_convert(self.text_view.get_text())
        clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
        clipboard.set_text(output, -1)
        clipboard.store() 
Example 20
Source File: GuiFunctions.py    From GridCal with GNU General Public License v3.0 5 votes vote down vote up
def copy_to_clipboard(self, mode=None):
        """
        Copy profiles to clipboard
        Args:
            mode: 'real', 'imag', 'abs'
        """
        n = len(self.cols_c)

        if n > 0:

            index, columns, data = self.get_data(mode=mode)

            data = data.astype(str)

            # header first
            txt = '\t' + '\t'.join(columns) + '\n'

            # data
            for t, index_value in enumerate(index):
                if data[t, :].sum() != 0.0:
                    txt += str(index_value) + '\t' + '\t'.join(data[t, :]) + '\n'

            # copy to clipboard
            cb = QApplication.clipboard()
            cb.clear(mode=cb.Clipboard)
            cb.setText(txt, mode=cb.Clipboard)

        else:
            # there are no elements
            pass 
Example 21
Source File: gui.py    From zim-desktop-wiki with GNU General Public License v2.0 5 votes vote down vote up
def copy_to_clipboard(self, *a):
		'''Exports currently visible elements from the tasks list'''
		logger.debug('Exporting to clipboard current view of task list.')
		text = self.get_visible_data_as_csv()
		Clipboard.set_text(text)
			# TODO set as object that knows how to format as text / html / ..
			# unify with export hooks 
Example 22
Source File: ObjectListView.py    From bookhub with MIT License 5 votes vote down vote up
def CopyObjectsToClipboard(self, objects):
        """
        Put a textual representation of the given objects onto the clipboard.

        This will be one line per object and tab-separated values per line.
        Under windows there will be a HTML table version put on the clipboard as well.
        """
        if objects is None or len(objects) == 0:
            return

        # Get all the values of the given rows into multi-list
        rows = self._GetValuesAsMultiList(objects)

        # Make a text version of the values
        lines = [ "\t".join(x) for x in rows ]
        txt = "\n".join(lines) + "\n"

        # Make a html version on Windows
        try:
            lines = [ "<td>" + "</td><td>".join(x) + "</td>" for x in rows ]
            html = "<table><tr>" + "</tr><tr>".join(lines) + "</tr></table>"
            self._PutTextAndHtmlToClipboard(txt, html)
        except ImportError:
            cb = wx.Clipboard()
            if cb.Open():
                cb.SetData(wx.TextDataObject(txt))
                cb.Flush()
                cb.Close() 
Example 23
Source File: ObjectListView.py    From bookhub with MIT License 5 votes vote down vote up
def CopySelectionToClipboard(self):
        """
        Copy the selected objects to the clipboard
        """
        self.CopyObjectsToClipboard(self.GetSelectedObjects()) 
Example 24
Source File: cases.py    From QualCoder with MIT License 5 votes vote down vote up
def copy_selected_text_to_clipboard(self):

        selectedText = self.ui.textBrowser.textCursor().selectedText()
        cb = QtWidgets.QApplication.clipboard()
        cb.clear(mode=cb.Clipboard)
        cb.setText(selectedText, mode=cb.Clipboard) 
Example 25
Source File: error_dialog.py    From asammdf with GNU Lesser General Public License v3.0 5 votes vote down vote up
def copy_to_clipboard(self, event):
        text = (
            f"Error: {self.error_message.text()}\n\nDetails: {self.trace.toPlainText()}"
        )
        QtWidgets.QApplication.instance().clipboard().setText(text) 
Example 26
Source File: compat_interface.py    From pfp with MIT License 5 votes vote down vote up
def CopyToClipboard(params, ctxt, scope, stream, coord):
    # resolved: won't implement
    pass


# void CutToClipboard() 
Example 27
Source File: paint.py    From 15-minute-apps with MIT License 5 votes vote down vote up
def copy_to_clipboard(self):
        clipboard = QApplication.clipboard()

        if self.canvas.mode == 'selectrect' and self.canvas.locked:
            clipboard.setPixmap(self.canvas.selectrect_copy())

        elif self.canvas.mode == 'selectpoly' and self.canvas.locked:
            clipboard.setPixmap(self.canvas.selectpoly_copy())

        else:
            clipboard.setPixmap(self.canvas.pixmap()) 
Example 28
Source File: __init__.py    From usdmanager with Apache License 2.0 5 votes vote down vote up
def copySelectionToClipboard(self):
        """ Store current selection to the middle mouse selection.
        
        Doing this on selectionChanged signal instead of mouseReleaseEvent causes the following to be output in Qt5:
        "QXcbClipboard: SelectionRequest too old"
        
        For some reason, this isn't needed for QTextEdit but is for QTextBrowser?
        """
        cursor = self.textCursor()
        if cursor.hasSelection():
            selection = cursor.selectedText().replace(u'\u2029', '\n')
            clipboard = QtWidgets.QApplication.clipboard()
            clipboard.setText(selection, clipboard.Selection) 
Example 29
Source File: TimelinePedigreeView.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def copy_person_to_clipboard_cb(self, obj, person_handle):
        """
        Renders the person data into some lines of text and
        puts that into the clipboard
        """
        person = self.dbstate.db.get_person_from_handle(person_handle)
        if person:
            clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
            clipboard.set_text(self.format_helper.format_person(person, 11), -1)
            return True
        return False 
Example 30
Source File: TimelinePedigreeView.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def copy_family_to_clipboard_cb(self, obj, family_handle):
        """
        Renders the family data into some lines of text and
        puts that into the clipboard
        """
        family = self.dbstate.db.get_family_from_handle(family_handle)
        if family:
            clipboard = Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)
            clipboard.set_text(self.format_helper.format_relation(family, 11), -1)
            return True
        return False 
Example 31
Source File: QuiltView.py    From addons-source with GNU General Public License v2.0 5 votes vote down vote up
def copy_person_to_clipboard(self, obj, person_handle):
        """
        Renders the person data into some lines of text
        and puts that into the clipboard.
        """
        person = self.dbstate.db.get_person_from_handle(person_handle)
        if person:
            cb = Gtk.Clipboard.get_for_display(Gdk.Display.get_default(),
                                               Gdk.SELECTION_CLIPBOARD)
            cb.set_text(self.format_helper.format_person(person, 11), -1)
            return True
        return False 
Example 32
Source File: __init__.py    From visionary with MIT License 5 votes vote down vote up
def copy_to_clipboard(generated):
    global copied
    selection = safe_input('Which password would you like to copy? [1/2/3] ').strip()
    if selection in ['1', '2', '3']:
        password = generated[int(selection) - 1]
    else:
        print(color('Invalid option. Pick either 1, 2 or 3.\n', Fore.RED))
        return copy_to_clipboard(generated)
    try:
        pyperclip.copy(password)
        copied = True
        print('\nCopied!\n')
    except pyperclip.exceptions.PyperclipException:
        print(color('Could not copy! If you\'re using linux, make sure xclip is installed.\n', Fore.RED)) 
Example 33
Source File: FBFindCommands.py    From chisel with MIT License 5 votes vote down vote up
def printMatchesInViewOutputStringAndCopyFirstToClipboard(needle, haystack):
    first = None
    for match in re.finditer(
        ".*<.*(" + needle + ")\\S*: (0x[0-9a-fA-F]*);.*", haystack, re.IGNORECASE
    ):
        view = match.groups()[-1]
        className = fb.evaluateExpressionValue(
            "(id)[(" + view + ") class]"
        ).GetObjectDescription()
        print("{} {}".format(view, className))
        if first is None:
            first = view
            cmd = 'echo %s | tr -d "\n" | pbcopy' % view
            os.system(cmd) 
Example 34
Source File: filesystem_treeview.py    From Turing with MIT License 5 votes vote down vote up
def copy_path_to_clipboard(self):
        """
        Copies the file path to the clipboard
        """
        path = self.get_current_path()
        QtWidgets.QApplication.clipboard().setText(path)
        debug('path copied: %s' % path) 
Example 35
Source File: compat_interface.py    From pfp with MIT License 5 votes vote down vote up
def CopyStringToClipboard(params, ctxt, scope, stream, coord):
    # resolved: won't implement
    pass


# void CopyToClipboard() 
Example 36
Source File: compat_interface.py    From pfp with MIT License 5 votes vote down vote up
def CopyBytesToClipboard(params, ctxt, scope, stream, coord):
    # resolved: won't implement
    pass


# void CopyStringToClipboard( const char str[], int charset=CHARSET_ANSI ) 
Example 37
Source File: gui.py    From clix with MIT License 5 votes vote down vote up
def copy_to_clipboard(self, idx):
        """
        function to copy text of frame no. idx to clipboard
        """
        text = self.textBoxes[idx].get("1.0", END)
        xerox.copy(text) 
Example 38
Source File: qt_plugin_report.py    From napari with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def copyToClipboard(self) -> None:
        """Copy current plugin traceback info to clipboard as plain text."""
        plugin = self.plugin_combo.currentText()
        err_string = format_exceptions(plugin, as_html=False)
        cb = QGuiApplication.clipboard()
        cb.setText(err_string) 
Example 39
Source File: util.py    From lighthouse with MIT License 5 votes vote down vote up
def copy_to_clipboard(data):
    """
    Copy the given data (a string) to the system clipboard.
    """
    cb = QtWidgets.QApplication.clipboard()
    cb.clear(mode=cb.Clipboard)
    cb.setText(data, mode=cb.Clipboard) 
Example 40
Source File: core.py    From chepy with GNU General Public License v3.0 5 votes vote down vote up
def copy_to_clipboard(self) -> None:  # pragma: no cover
        """Copy to clipboard
        
        Copy the final output to the clipboard. If an 
        error is raised, refer to the documentation on the error.
        
        Returns:
            None: Copies final output to the clipboard
        """
        pyperclip.copy(self._convert_to_str())
        return None 
Example 41
Source File: struct_table.py    From mhw_armor_edit with The Unlicense 5 votes vote down vote up
def copy_selection_to_clipboard(self):
        selected_indexes = self.selectionModel().selectedIndexes()
        if not selected_indexes or len(selected_indexes) == 0:
            return
        model = self.model()
        result = "\n".join(
            "\t".join(row)
            for row in self.selected_rows(model, selected_indexes)
        )
        cp = QApplication.clipboard()
        cp.setText(result) 
Example 42
Source File: filesbrowserbase.py    From codimension with GNU General Public License v3.0 5 votes vote down vote up
def copyToClipboard(self):
        """Copies the path to the file where the element is to the clipboard"""
        item = self.model().item(self.currentIndex())
        path = item.getPath()
        QApplication.clipboard().setText(path) 
Example 43
Source File: filesystem_treeview.py    From Turing with MIT License 5 votes vote down vote up
def copy_to_clipboard(self, copy=True):
        """
        Copies the selected items to the clipboard
        :param copy: True to copy, False to cut.
        """
        urls = self.selected_urls()
        if not urls:
            return
        mime = self._UrlListMimeData(copy)
        mime.set_list(urls)
        clipboard = QtWidgets.QApplication.clipboard()
        clipboard.setMimeData(mime) 
Example 44
Source File: logging.py    From plugin.program.openwizard with GNU General Public License v3.0 4 votes vote down vote up
def copy_to_clipboard(txt):
    import subprocess

    platform = tools.platform()
    if platform == 'windows':
        try:
            cmd = 'echo ' + txt.strip() + '|clip'
            return subprocess.check_call(cmd, shell=True)
            pass
        except:
            pass
    elif platform == 'linux':
        try:
            from subprocess import Popen, PIPE

            p = Popen(['xsel', '-pi'], stdin=PIPE)
            p.communicate(input=txt)
        except:
            pass
    else:
        pass


# CURRENTLY NOT IN USE
# def email_log(email, results, file):
    # URL = 'http://aftermathwizard.net/mail_logs.php'
    # data = {'email': email, 'results': results, 'file': file, 'wizard': CONFIG.ADDONTITLE}
    # params = urlencode(data)

    # try:
        # result = LogURLopener().open(URL, params)
        # returninfo = result.read()
        # log(str(returninfo))
    # except Exception as e:
        # a = 'failed to connect to the server'
        # log("{0}: {1}".format(a, str(e)), level=xbmc.LOGERROR)
        # return False, a

    # try:
        # return True, "Emailing logs is currently disabled."
        # # js_data = json.loads(returninfo)

        # # if 'type' in js_data:
            # # return js_data['type'], str(js_data['text'])
        # # else:
            # # return str(js_data)
    # except Exception as e:
        # log("ERROR: {0}".format(str(e)), level=xbmc.LOGERROR)
        # return False, "Error Sending Email."