0% found this document useful (0 votes)
5 views12 pages

Otomasyon Python

Uploaded by

robespiyer19
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views12 pages

Otomasyon Python

Uploaded by

robespiyer19
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

# -*- coding: utf-8 -*-

# Hukuk Otomasyonu v.1.8 (Python/KivyMD)


# Yazar: Piiri (Ordinaryüs Prof. Avukat Rolüyle)

from [Link] import Builder


from [Link] import MDApp
from [Link] import MDScreen
from [Link] import MDList, TwoLineListItem
from [Link] import Snackbar
from [Link] import MDDropdownMenu
from [Link] import MDDatePicker
from datetime import datetime, timedelta

# --- 1. VERİ SİMÜLASYONU (v.1.7'deki Veritabanı Yapısı) ---

# Kullanıcılar ve Yetkilendirme
USERS = {
"patron": {"sifre": "1234", "rol": "Yönetici"},
"avukat_a": {"sifre": "4321", "rol": "Avukat"},
}

# Müvekkiller
MUVEKKILLER = [
{"id": 1, "ad": "Mehmet Çelik"},
{"id": 2, "ad": "Ayşe Yılmaz"},
{"id": 3, "ad": "Mustafa Kılıç"},
]

# Dosyalar (Müvekkil ile İlişkilendirilmiş)


DOSYALAR = [
{"id": 101, "muvekkil_id": 1, "ad": "İcra Takibi (2024/101 E.)"},
{"id": 102, "muvekkil_id": 1, "ad": "Tapu İptal Davası (2024/25 K.)"},
{"id": 201, "muvekkil_id": 2, "ad": "Boşanma Davası (2023/500 E.)"},
{"id": 301, "muvekkil_id": 3, "ad": "Tazminat Davası (2025/110 E.)"},
]

# Kanuni Süreler ve Mahkeme Türleri


KANUNI_SURELER = {
"Cevap Dilekçesi Sunumu": 15, # HMK 317 (2 hafta + 1 gün)
"İstinaf Başvurusu": 14, # Kanuni 2 hafta
"Delil Sunma Süresi": 7,
"Beyan Süresi": 10,
}

MAHKEME_TURLERI = [
"Asliye Hukuk", "Sulh Hukuk", "Ağır Ceza", "Asliye Ceza",
"İcra Müdürlüğü", "İdare", "Vergi", "Aile", "Kadastro", "Ç. Ağır Ceza"
]

# --- 2. KIVYMD ARAYÜZ TANIMI (KV Dilinde) ---

KV_CODE = """
ScreenManager:
LoginScreen:
name: 'login'
DashboardScreen:
name: 'dashboard'
AraKararScreen:
name: 'arakarar'
<LoginScreen>:
MDBoxLayout:
orientation: 'vertical'
spacing: '10dp'
padding: '20dp'
md_bg_color: self.theme_cls.primary_color
MDIcon:
icon: "gavel"
halign: "center"
theme_text_color: "Custom"
text_color: [1, 1, 1, 1]
font_size: "60sp"
MDLabel:
text: "HUKUK OTOMASYONU v.1.8"
halign: "center"
font_style: "H4"
theme_text_color: "Custom"
text_color: [1, 1, 1, 1]
size_hint_y: None
height: self.texture_size[1]
MDTextField:
id: username_field
hint_text: "Kullanıcı Adı"
mode: "rectangle"
line_color_focus: [1, 1, 1, 1]
text_color: [1, 1, 1, 1]
pos_hint: {'center_x': 0.5, 'center_y': 0.6}
MDTextField:
id: password_field
hint_text: "Şifre"
mode: "rectangle"
password: True
line_color_focus: [1, 1, 1, 1]
text_color: [1, 1, 1, 1]
pos_hint: {'center_x': 0.5, 'center_y': 0.5}
MDRaisedButton:
text: "Giriş Yap"
md_bg_color: [0, 0, 0, 1] # Siyah Buton
on_release: app.login_user(username_field.text, password_field.text)
pos_hint: {'center_x': 0.5}

<DashboardScreen>:
MDBoxLayout:
orientation: 'vertical'
MDTopAppBar:
title: "Operasyon Merkezi v.1.8"
right_action_items: [['logout', lambda x: [Link] = 'login']]
MDBoxLayout:
padding: '10dp'
spacing: '10dp'
size_hint_y: None
height: '100dp'
MDRaisedButton:
text: "📁 Dava Aç/Dosya"
MDRaisedButton:
text: "💰 Finans/Kasa"
MDRaisedButton:
text: "🚨 Akıllı Ara Karar"
on_release: [Link] = 'arakarar'
MDRaisedButton:
text: "⚖️İcra Takip"
MDLabel:
text: "Bugünün Duruşmaları ve Kritik Süreler (v.1.7 Analizi)"
padding: ['10dp', 0]
size_hint_y: None
height: self.texture_size[1]
ScrollView:
MDList:
TwoLineListItem:
text: "2024/101 E. - Acil Beyan Süresi"
secondary_text: "Mahkeme: Asliye Hukuk 14 (3 Gün Kaldı)"
TwoLineListItem:
text: "2023/500 E. - Duruşma"
secondary_text: "Mahkeme: Aile Hukuk 5 (Saat 10:30)"

<AraKararScreen>:
MDBoxLayout:
orientation: 'vertical'
MDTopAppBar:
title: "Akıllı Ara Karar Modülü"
left_action_items: [['arrow-left', lambda x: [Link] = 'dashboard']]

MDBoxLayout:
orientation: 'vertical'
padding: '10dp'
spacing: '10dp'

# 1. Müvekkil Seçimi
MDTextField:
id: muvekkil_input
hint_text: "Müvekkil Seç (Zorunlu)"
on_focus: if [Link]: app.show_muvekkil_menu(self)

# 2. Dosya Seçimi (Müvekkil'e göre filtrelenir)


MDTextField:
id: dosya_input
hint_text: "Dosya Seç (Müvekkil seçilince açılır)"
disabled: True
on_focus: if [Link] and not [Link]: app.show_dosya_menu(self)

# 3. Mahkeme Bilgileri (v.1.7'deki gibi iki kutu)


MDBoxLayout:
size_hint_y: None
height: '48dp'
spacing: '10dp'
MDTextField:
id: mahkeme_no_input
hint_text: "Mahkeme No (Örn: 14)"
size_hint_x: 0.3
MDTextField:
id: mahkeme_tur_input
hint_text: "Mahkeme Türü Seç"
size_hint_x: 0.7
on_focus: if [Link]: app.show_mahkeme_menu(self)

# 4. Süre Seçimi
MDTextField:
id: is_turu_input
hint_text: "İş Türü Seç (Kanuni Süre)"
on_focus: if [Link]: app.show_sure_menu(self)
on_text: app.update_sure_gun(is_turu_input.text)

# 5. Tebliğ/Başlangıç Tarihi
MDTextField:
id: teblig_tarih_input
hint_text: "Tebliğ Tarihi (Gerekli)"
on_focus: if [Link]: app.show_date_picker(self)

# 6. Otomatik Süre Hesaplama Sonucu (Kırmızı Kutu)


MDCard:
md_bg_color: app.theme_cls.error_color # Kırmızı
size_hint_y: None
height: '60dp'
padding: '10dp'
MDLabel:
id: son_tarih_label
text: "SON TARİH: Hesaplama Bekleniyor..."
halign: 'center'
theme_text_color: "Custom"
text_color: [1, 1, 1, 1]

MDRaisedButton:
text: "Ara Karar/İş Kaydet"
md_bg_color: app.theme_cls.primary_color
pos_hint: {'center_x': 0.5}

"""

# --- 3. PYHTON UYGULAMA SINIFI ---


class LoginScreen(MDScreen):
pass

class DashboardScreen(MDScreen):
pass

class AraKararScreen(MDScreen):
pass

class HukukOtomasyonApp(MDApp):

selected_muvekkil_id = None

def build(self):
self.theme_cls.primary_palette = "Indigo"
self.theme_cls.accent_palette = "Red"
return Builder.load_string(KV_CODE)

def login_user(self, username, password):


"""Kullanıcı girişi kontrolü ve yetkilendirme."""
if username in USERS and USERS[username]["sifre"] == password:
[Link] = 'dashboard'
Snackbar(
text=f"Hoşgeldiniz, {[Link]()}! Rol: {USERS[username]['rol']}",
snackbar_x="10dp",
snackbar_y="10dp",
size_hint_x=([Link] - 20) / [Link],
).open()
else:
Snackbar(
text="Hata: Kullanıcı adı veya şifre hatalı.",
snackbar_x="10dp",
snackbar_y="10dp",
size_hint_x=([Link] - 20) / [Link],
).open()

# --- Müvekkil Seçimi Mantığı ---


def show_muvekkil_menu(self, instance):
"""Müvekkil listesinden seçim menüsünü gösterir."""
menu_items = [
{"viewclass": "OneLineListItem", "text": m["ad"], "on_release": lambda x=m:
self.select_muvekkil(x, instance)}
for m in MUVEKKILLER
]
self.muvekkil_menu = MDDropdownMenu(caller=instance, items=menu_items,
width_mult=4)
self.muvekkil_menu.open()

def select_muvekkil(self, muvekkil_data, instance):


"""Müvekkil seçildiğinde dosya listesini günceller."""
[Link] = muvekkil_data["ad"]
self.selected_muvekkil_id = muvekkil_data["id"]

# Dosya alanını aktif et ve dosya listesini filtrele


[Link].get_screen('arakarar').ids.dosya_input.disabled = False
[Link].get_screen('arakarar').ids.dosya_input.text = "Dosya Seç..."
self.muvekkil_menu.dismiss()

# --- Dosya Seçimi Mantığı (Filtreleme) ---


def show_dosya_menu(self, instance):
"""Seçilen müvekkile ait dosyaları listeler."""
# Filtreleme (v.1.7 mantığı)
filtered_dosyalar = [d for d in DOSYALAR if d["muvekkil_id"] ==
self.selected_muvekkil_id]

menu_items = [
{"viewclass": "OneLineListItem", "text": d["ad"], "on_release": lambda x=d:
self.select_dosya(x, instance)}
for d in filtered_dosyalar
]

self.dosya_menu = MDDropdownMenu(caller=instance, items=menu_items,


width_mult=4)
self.dosya_menu.open()

def select_dosya(self, dosya_data, instance):


[Link] = dosya_data["ad"]
self.dosya_menu.dismiss()

# --- Mahkeme Türü Seçimi Mantığı (v.1.7) ---


def show_mahkeme_menu(self, instance):
"""Türk Hukukundaki Mahkeme Türlerini listeler."""
menu_items = [
{"viewclass": "OneLineListItem", "text": t, "on_release": lambda x=t:
self.select_mahkeme(x, instance)}
for t in MAHKEME_TURLERI
]
self.mahkeme_menu = MDDropdownMenu(caller=instance, items=menu_items,
width_mult=4)
self.mahkeme_menu.open()

def select_mahkeme(self, mahkeme_tur, instance):


[Link] = mahkeme_tur
self.mahkeme_menu.dismiss()

# --- Süre Seçimi ve Hesaplama Mantığı ---


def show_sure_menu(self, instance):
"""Kanuni Süre türlerini listeler."""
menu_items = [
{"viewclass": "OneLineListItem", "text": t, "on_release": lambda x=t:
self.select_sure(x, instance)}
for t in KANUNI_SURELER.keys()
]
self.sure_menu = MDDropdownMenu(caller=instance, items=menu_items,
width_mult=4)
self.sure_menu.open()

def select_sure(self, sure_turu, instance):


[Link] = sure_turu
self.sure_menu.dismiss()
self.update_son_tarih()

def update_sure_gun(self, sure_turu):


"""Seçilen iş türüne göre kanuni süreyi günceller (Simülasyon)."""
# Burada sadece görsel bilgi akışını sağlıyoruz
pass

def update_son_tarih(self, *args):


"""Tebliğ tarihi ve İş türüne göre son kanuni tarihi hesaplar."""
teblig_tarihi_str = [Link].get_screen('arakarar').ids.teblig_tarih_input.text
is_turu = [Link].get_screen('arakarar').ids.is_turu_input.text

if not teblig_tarihi_str or is_turu not in KANUNI_SURELER:


[Link].get_screen('arakarar').ids.son_tarih_label.text = "SON TARİH: Hesaplama
Bekleniyor..."
return

try:
# Tarihi DD/MM/YYYY formatından çevir
teblig_tarihi = [Link](teblig_tarihi_str, "%d/%m/%Y")
sure_gun = KANUNI_SURELER[is_turu]

# Son tarihi hesapla


son_tarih = teblig_tarihi + timedelta(days=sure_gun)

# Hafta sonunu kontrol etme, sadece net gün ekleme simülasyonu

[Link].get_screen('arakarar').ids.son_tarih_label.text = f"SON TARİH:


{son_tarih.strftime('%d/%m/%Y')} ({sure_gun} Gün Süre)"
except ValueError:
[Link].get_screen('arakarar').ids.son_tarih_label.text = "SON TARİH: Tarih Formatı
Hatalı"

def show_date_picker(self, instance):


"""Takvim seçiciyi gösterir."""
date_dialog = MDDatePicker(callback=lambda date: self.on_date_save(date, instance))
date_dialog.open()

def on_date_save(self, date, instance):


"""Tarih seçildiğinde input alanını ve son tarihi günceller."""
[Link] = [Link]("%d/%m/%Y")
self.update_son_tarih()

if __name__ == '__main__':
HukukOtomasyonApp().run()

You might also like