Removed DOCX compatibility due to error on dependencies

This commit is contained in:
jeffser 2024-06-22 02:11:17 -06:00
parent 5f0cddffd0
commit e42e01a92c
3 changed files with 9 additions and 34 deletions

View File

@ -85,30 +85,6 @@
}
]
},
{
"name": "python3-python-docx",
"buildsystem": "simple",
"build-commands": [
"pip3 install --verbose --exists-action=i --no-index --find-links=\"file://${PWD}\" --prefix=${FLATPAK_DEST} \"python-docx\" --no-build-isolation"
],
"sources": [
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/63/f7/ffbb6d2eb67b80a45b8a0834baa5557a14a5ffce0979439e7cd7f0c4055b/lxml-5.2.2.tar.gz",
"sha256": "bb2dc4898180bea79863d5487e5f9c7c34297414bad54bcd0f0852aee9cfdb87"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/3e/3d/330d9efbdb816d3f60bf2ad92f05e1708e4a1b9abe80461ac3444c83f749/python_docx-1.1.2-py3-none-any.whl",
"sha256": "08c20d6058916fb19853fcf080f7f42b6270d89eac9fa5f8c15f691c0017fabe"
},
{
"type": "file",
"url": "https://files.pythonhosted.org/packages/26/9f/ad63fc0248c5379346306f8668cda6e2e2e9c95e01216d2b8ffd9ff037d0/typing_extensions-4.12.2-py3-none-any.whl",
"sha256": "04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"
}
]
},
{
"name": "ollama",
"buildsystem": "simple",

View File

@ -21,7 +21,7 @@ import gi
gi.require_version('GtkSource', '5')
gi.require_version('GdkPixbuf', '2.0')
from gi.repository import Adw, Gtk, Gdk, GLib, GtkSource, Gio, GdkPixbuf
import json, requests, threading, os, re, base64, sys, gettext, locale, webbrowser, subprocess, uuid, shutil, tarfile, tempfile, docx
import json, requests, threading, os, re, base64, sys, gettext, locale, webbrowser, subprocess, uuid, shutil, tarfile, tempfile #, docx
from time import sleep
from io import BytesIO
from PIL import Image
@ -1137,13 +1137,13 @@ class AlpacaWindow(Adw.ApplicationWindow):
for i, page in enumerate(reader.pages):
text += f"\n- Page {i}\n{page.extract_text()}\n"
return text
elif file_type == 'docx':
document = docx.Document(file_path)
if len(document.paragraphs) == 0: return None
text = ""
for paragraph in document.paragraphs:
text += f"{paragraph.text}\n"
return text
#elif file_type == 'docx':
#document = docx.Document(file_path)
#if len(document.paragraphs) == 0: return None
#text = ""
#for paragraph in document.paragraphs:
#text += f"{paragraph.text}\n"
#return text
def remove_attached_file(self, button):
del self.attachments[button.get_name()]
@ -1162,7 +1162,7 @@ class AlpacaWindow(Adw.ApplicationWindow):
"image": "image-x-generic-symbolic",
"plain_text": "document-text-symbolic",
"pdf": "document-text-symbolic",
"docx": "document-text-symbolic"
#"docx": "document-text-symbolic"
}[file_type]
)
button = Gtk.Button(

View File

@ -913,7 +913,6 @@
<suffix>json</suffix>
<suffix>xml</suffix>
<suffix>pdf</suffix>
<suffix>docx</suffix>
<suffix>png</suffix>
<suffix>jpeg</suffix>
<suffix>webp</suffix>