Skip to content

Commit f8a0c7b

Browse files
Merge pull request #1 from cyberfantics/cyberfantics
Enhancements to Streamlit App
2 parents fd1eb40 + d55fa29 commit f8a0c7b

File tree

6 files changed

+113
-158
lines changed

6 files changed

+113
-158
lines changed

Diff for: app.py

+41-158
Original file line numberDiff line numberDiff line change
@@ -1,165 +1,30 @@
11
import base64
22
import streamlit as st
33
from fpdf import FPDF
4-
import os
4+
import os, json
55
from PIL import Image
66

77
# HEX renk kodunu RGB formatına dönüştürme fonksiyonu
88
def hex_to_rgb(hex):
99
hex = hex.lstrip('#')
1010
return tuple(int(hex[i:i+2], 16) for i in (0, 2, 4))
1111

12-
def get_text(lang):
13-
if lang == "Türkçe":
14-
return {
15-
"project_title": "📄 Proje Hakkında",
16-
"project_goal": "Amaç ve Hedefler",
17-
"project_details": """
18-
Bu uygulama, kullanıcıların etkileyici ve profesyonel görünümlü PDF belgeleri oluşturmasını sağlayan güçlü bir dijital belge yönetim aracıdır.
19-
İş dünyasından eğitime, akademik çalışmalardan kişisel kullanıma kadar geniş bir yelpazede yüksek kaliteli belgeler oluşturmayı mümkün kılar.
20-
Kullanıcıların içerikleri özelleştirmesine, görsel ve tablo eklemelerine, stil ve format seçenekleri sunmasına olanak tanıyan bu araç, kullanıcı dostu ve dinamik bir arayüz sunar.
21-
22-
**Ana Amaçlar ve Hedefler:**
23-
- **Profesyonel PDF Belgeleri Oluşturma:** İş, eğitim ve kişisel kullanım için farklı format ve stillerde profesyonel görünümlü PDF belgeleri hazırlamak.
24-
- **Gelişmiş Düzenleme Araçları:** Kullanıcıların belgelerini özelleştirmesine olanak tanıyan çeşitli düzenleme seçenekleri sunmak.
25-
- **Kullanıcı Deneyimini Artırma:** Kolay kullanılabilir arayüz ve güçlü özellikler ile kullanıcı memnuniyetini en üst düzeye çıkarmak.
26-
- **Çok Yönlü Kullanım Alanı:** Farklı kullanıcı ihtiyaçlarına hitap eden esnek bir çözüm sunmak; raporlar, sunumlar, eğitim materyalleri ve daha fazlası için ideal.
27-
28-
**Uygulamanın Öne Çıkan Özellikleri:**
29-
- **Çoklu Dil ve Format Desteği:** Birden fazla dil ve belge formatı desteği sunarak, kullanıcıların ihtiyaçlarına uygun belgeler oluşturmalarına olanak tanır.
30-
- **Dinamik İçerik Yönetimi:** Metin düzenleme, tablo ekleme, görsel entegrasyonu ve sayfa tasarımı ile zengin içerikli belgeler yaratma imkanı.
31-
- **Otomatik Kaydetme ve Taslak Yönetimi:** Belge oluşturma sırasında otomatik kaydetme ve taslak yönetimi özellikleri ile kullanıcı verilerinin korunmasını sağlar.
32-
- **Güvenli ve Ölçeklenebilir Mimari:** Kullanıcı verilerinin güvenliğini ve veri bütünlüğünü sağlayan güçlü altyapı.
33-
- **Gerçek Zamanlı Önizleme ve Düzenleme:** Kullanıcıların belgeyi indirmeden önce nasıl görüneceğini önizleyip düzenleyebilmesi.
34-
- **Temalar ve Şablonlar:** Önceden tanımlanmış temalar ve şablonlar ile kullanıcıların belge oluşturma sürecini hızlandırın ve kolaylaştırın.
35-
36-
**Kullanım Alanları:**
37-
- **İş Dünyası:** Şirket içi raporlar, sunumlar, eğitim materyalleri ve strateji belgeleri oluşturmak için.
38-
- **Eğitim ve Akademik Çalışmalar:** Öğretmenler, öğrenciler ve araştırmacılar için akademik makaleler, tezler ve ders notları hazırlamak için.
39-
- **Kişisel Kullanım:** Özgeçmişler, davetiyeler, kartvizitler ve diğer kişisel belgeleri düzenleyip oluşturmak için.
40-
""",
41-
"system_info_title": "🖥️ Sistem Bilgisi",
42-
"system_info_details": """
43-
Uygulamamız, Python ve Streamlit teknolojileri kullanılarak geliştirilmiştir ve PDF oluşturma işlemleri için **FPDF** ve **Pillow** kütüphanelerinden faydalanır.
44-
Güçlü bir arka uç ve sezgisel bir ön yüz arayüzü sunarak, kullanıcıların belgelerini kolayca düzenleyip oluşturmasına olanak tanır.
45-
46-
**Teknik Özellikler:**
47-
- **Ön Yüz (Frontend):** Streamlit ile modern ve kullanıcı dostu bir arayüz.
48-
- **Arka Yüz (Backend):** Python tabanlı altyapı, verimli ve hızlı belge oluşturma süreçleri sunar.
49-
- **Veri İşleme ve Görselleştirme:** FPDF ve Pillow kütüphaneleri kullanılarak gelişmiş veri işleme ve görselleştirme işlevleri.
50-
- **Güvenlik ve Performans:** Kullanıcı verilerinin şifreleme ile korunması ve ölçeklenebilir yüksek performanslı altyapı.
51-
- **Güncellemeler ve Destek:** Uygulama sürekli güncellenmekte ve kullanıcı geri bildirimlerine dayalı geliştirmeler yapılmaktadır.
52-
""",
53-
"pdf_creator": "📄 Gelişmiş PDF Oluşturucu Uygulaması",
54-
"pdf_creator_details": """
55-
Kullanıcılar, zengin metin formatları, tablo düzenleyici ve görsel ekleme seçenekleri ile profesyonel görünümlü PDF belgeleri oluşturabilirler.
56-
PDF'ler, kullanıcıların iş ihtiyaçlarına, eğitim gereksinimlerine veya kişisel taleplerine göre özelleştirilebilir.
57-
58-
**PDF Oluşturucu Kullanım Adımları:**
59-
1. **Metin ve İçerik Ekleme:** Belgeye eklenecek metinleri girin ve düzenleme seçeneklerini kullanarak stil ve format ayarlarını yapın.
60-
2. **Görsel ve Tablolar Ekleme:** Belgede kullanılacak görselleri ve tabloları yükleyin ve düzenleyin.
61-
3. **Özelleştirilmiş Ayarlar:** Sayfa boyutu, düzen, kenar boşlukları gibi özellikleri belirleyin.
62-
4. **Önizleme ve İndir:** PDF belgenizi oluşturun, önizleyin ve cihazınıza indirin.
63-
""",
64-
"feedback": "Kullanıcı Deneyimi Geri Bildirimi",
65-
"feedback_description": """
66-
Uygulamamız hakkında geri bildirimde bulunarak bize yardımcı olabilirsiniz. Geri bildirimleriniz, ürünümüzü daha da geliştirmemize ve kullanıcı memnuniyetini artırmamıza yardımcı olacaktır.
67-
""",
68-
"feedback_questions": [
69-
"Uygulamamızın genel performansını nasıl değerlendirirsiniz?",
70-
"PDF oluşturucu arayüzünü ne kadar kullanıcı dostu buldunuz?",
71-
"Eklenmesini istediğiniz özellikler veya geliştirmeler var mı?",
72-
"Metin ve görsel ekleme işlemleri ne kadar kolay ve anlaşılır?",
73-
"Uygulamanın tasarımı ve kullanıcı deneyimi hakkındaki düşünceleriniz nelerdir?",
74-
"Farklı dillerde PDF oluşturma seçeneklerini ne kadar kullanışlı buldunuz?",
75-
],
76-
"contact_title": "📞 Geliştiriciyle İletişim",
77-
"contact_description": """
78-
**Merhaba! Ben Pınar Topuz,** bu uygulamanın geliştiricisiyim. Yazılım geliştirme ve kullanıcı dostu çözümler yaratma konusundaki tutkum, bu uygulamayı geliştirmemde büyük rol oynadı. Kullanıcılara en iyi belge yönetim deneyimini sunmak için buradayım.
79-
80-
**İletişim Bilgilerim:**
81-
- 📧 **E-posta:** [[email protected]](mailto:[email protected])
82-
- 💼 **LinkedIn:** [LinkedIn Profilim](https://www.linkedin.com/in/piinartp)
83-
- 👨‍💻 **GitHub:** [GitHub Profilim](https://github.com/ThecoderPinar)
84-
85-
İletişime geçmekten çekinmeyin! Geri bildirimleriniz, önerileriniz ve sorularınız için her zaman buradayım.
86-
""",
87-
}
88-
else: # Default English
89-
return {
90-
"project_title": "📄 About the Project",
91-
"project_goal": "Objectives and Goals",
92-
"project_details": """
93-
This application is a robust digital document management tool that empowers users to create visually appealing and professionally styled PDF documents.
94-
It enables the creation of high-quality documents needed for business, education, and personal use, offering a user-friendly and dynamic interface with options to customize content, add images and tables, and adjust styles and formats.
95-
96-
**Key Objectives and Goals:**
97-
- **Create Professional PDF Documents:** Design professional-looking PDF documents in various formats and styles for business, education, and personal use.
98-
- **Advanced Editing Tools:** Provide a range of editing options that allow users to customize their documents.
99-
- **Enhance User Experience:** Maximize user satisfaction with an easy-to-use interface and powerful features.
100-
- **Versatile Use Cases:** Offer a flexible solution that caters to different user needs; ideal for reports, presentations, training materials, and more.
101-
102-
**Highlight Features of the Application:**
103-
- **Multi-language and Format Support:** Offers support for multiple languages and document formats, allowing users to create documents that meet their needs.
104-
- **Dynamic Content Management:** Provides options for text editing, table insertion, image integration, and page design to create rich-content documents.
105-
- **Auto Save and Draft Management:** Ensures data preservation with auto-save and draft management features during document creation.
106-
- **Secure and Scalable Architecture:** Ensures the security and integrity of user data with a robust infrastructure.
107-
- **Real-Time Preview and Editing:** Allows users to preview and edit the document before downloading.
108-
- **Themes and Templates:** Speed up and simplify the document creation process with predefined themes and templates.
109-
110-
**Use Cases:**
111-
- **Business:** Create internal reports, presentations, training materials, and strategy documents for business.
112-
- **Education and Academic Work:** Prepare academic papers, theses, and lecture notes for teachers, students, and researchers.
113-
- **Personal Use:** Easily design and create resumes, invitations, business cards, and other personal documents.
114-
""",
115-
"system_info_title": "🖥️ System Information",
116-
"system_info_details": """
117-
Our application is developed using Python and Streamlit technologies and leverages **FPDF** and **Pillow** libraries for PDF creation processes.
118-
It offers a powerful backend and an intuitive frontend interface, allowing users to easily edit and create documents.
119-
120-
**Technical Specifications:**
121-
- **Frontend:** Modern and user-friendly interface built with Streamlit.
122-
- **Backend:** Python-based backend optimized for efficient and fast document creation processes.
123-
- **Data Processing and Visualization:** Advanced data processing and visualization functions powered by FPDF and Pillow libraries.
124-
- **Security and Performance:** Ensures data security with encryption and provides a scalable high-performance architecture.
125-
- **Updates and Support:** The application is continuously updated, with improvements based on user feedback.
126-
""",
127-
"pdf_creator": "📄 Advanced PDF Creator Application",
128-
"pdf_creator_details": """
129-
Users can create professional-looking PDF documents with rich text formatting, table editor, and image insertion options.
130-
PDFs can be customized according to users' business needs, educational requirements, or personal preferences.
131-
132-
**Steps to Use the PDF Creator:**
133-
1. **Add Text and Content:** Enter the text to be added to the document and adjust style and format settings using editing options.
134-
2. **Insert Images and Tables:** Upload and arrange the images and tables to be used in the document.
135-
3. **Custom Settings:** Define page size, layout, margins, and other features.
136-
4. **Preview and Download:** Create your PDF document, preview it, and download it to your device.
137-
""",
138-
"feedback": "User Experience Feedback",
139-
"feedback_description": """
140-
Help us improve by providing feedback about our application. Your feedback will help us enhance our product and increase user satisfaction.
141-
""",
142-
"feedback_questions": [
143-
"How would you rate the overall performance of our application?",
144-
"How user-friendly did you find the PDF creator interface?",
145-
"Are there any features or improvements you would like to see added?",
146-
"How easy and intuitive was it to add text and images?",
147-
"What are your thoughts on the design and user experience of the application?",
148-
"How useful did you find the options for creating PDFs in different languages?",
149-
],
150-
"contact_title": "📞 Contact the Developer",
151-
"contact_description": """
152-
**Hello! I'm Pınar Topuz,** the developer of this application. My passion for software development and creating user-friendly solutions played a significant role in developing this app. I am here to provide the best document management experience to users.
153-
154-
**My Contact Information:**
155-
- 📧 **Email:** [[email protected]](mailto:[email protected])
156-
- 💼 **LinkedIn:** [My LinkedIn Profile](https://www.linkedin.com/in/piinartp)
157-
- 👨‍💻 **GitHub:** [My GitHub Profile](https://github.com/ThecoderPinar)
158-
159-
Feel free to reach out! I'm always here for your feedback, suggestions, and questions.
160-
""",
161-
}
12+
# Function to load data from JSON file
13+
def load_language_data(file_path):
14+
with open(file_path, 'r', encoding='utf-8') as file:
15+
data = json.load(file)
16+
return data
16217

18+
def get_text(lang):
19+
try:
20+
file_path = 'data/languages.json'
21+
data = load_language_data(file_path)
22+
# Return the specific text based on language and key
23+
return data[lang]
24+
25+
except Exception as e:
26+
# Return a default message
27+
return f"Error {e} occured in loading {lang} language."
16328

16429
# Dil Seçimi
16530
st.sidebar.title("Dil Seçimi / Language Selection")
@@ -172,19 +37,35 @@ def get_text(lang):
17237
st.markdown(
17338
"""
17439
<style>
40+
@keyframes gradient {
41+
0% { background-position: 0% 50%; }
42+
50% { background-position: 100% 50%; }
43+
100% { background-position: 0% 50%; }
44+
}
17545
body {
176-
background: linear-gradient(270deg, #ff7675, #74b9ff, #55efc4);
46+
background: linear-gradient(270deg, #5a85c7, #85c785, #ffc785);
17747
background-size: 600% 600%;
17848
animation: gradient 16s ease infinite;
179-
color: white;
49+
color: #D3D3D3; /* Light grey for body text */
18050
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
18151
}
18252
.main {
183-
background-color: #2c3e50;
53+
background-color: #1c2833; /* Darker background for high contrast */
18454
padding: 2rem;
18555
border-radius: 10px;
18656
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
18757
}
58+
/* Heading styles with different colors */
59+
h1, h2, h3, h4, h5, h6 {
60+
color: #87CEEB; /* Sky blue for headings */
61+
}
62+
/* Ensuring paragraphs are a different color */
63+
li {
64+
color: #D3D3D3 !important; /* Light grey for paragraphs */
65+
}
66+
p {
67+
color: #228B22 !important;
68+
}
18869
</style>
18970
""",
19071
unsafe_allow_html=True
@@ -196,9 +77,11 @@ def contact_page():
19677
st.write(text["contact_description"])
19778

19879
# Profil fotoğrafını gösterme
199-
developer_photo = text.get("developer_photo", None)
80+
developer_photo = text["developer_photo"]
20081
if developer_photo and os.path.exists(developer_photo):
20182
st.image(developer_photo, width=200)
83+
else:
84+
st.write("Developer photo not present")
20285

20386
# UTF-8 destekli FPDF sınıfı
20487
class PDFGenerator(FPDF):
@@ -210,9 +93,9 @@ def __init__(self):
21093

21194
def load_fonts(self):
21295
"""Yazı tiplerini yükler ve PDF'de kullanıma hazır hale getirir."""
213-
font_path_normal = os.path.join(os.path.dirname(__file__), 'DejaVuSans.ttf')
214-
font_path_bold = os.path.join(os.path.dirname(__file__), 'dejavu-sans-bold.ttf')
215-
font_path_italic = os.path.join(os.path.dirname(__file__), 'DejaVuSans-Oblique.ttf')
96+
font_path_normal = os.path.join(os.path.dirname(__file__), 'fonts/DejaVuSans.ttf')
97+
font_path_bold = os.path.join(os.path.dirname(__file__), 'fonts/dejavu-sans-bold.ttf')
98+
font_path_italic = os.path.join(os.path.dirname(__file__), 'fonts/DejaVuSans-Oblique.ttf')
21699

217100
if os.path.exists(font_path_normal):
218101
self.add_font('DejaVu', '', font_path_normal, uni=True)

0 commit comments

Comments
 (0)