Commit 3d7f628a authored by Avi Wadhwa's avatar Avi Wadhwa
Browse files

progress! can now list all files inside the stack inside the second stack, and...

progress! can now list all files inside the stack inside the second stack, and now hidden back button, plus slide animation
parent 019215b1
No preview for this file type
# ninja log v5
0 14 1549003787 src/organizer.gresource 78c4809cb7171ed0
1 1198 1547124836 data/org.gnome.Organizer.appdata.xml d5833cf89d9d45a7
1 1229 1547124836 data/org.gnome.Organizer.desktop 5eef453bac4365cd
0 17 1548606287 src/organizer.gresource 78c4809cb7171ed0
0 1440 0 meson-install 9bd7faa9472bf40f
0 1493 0 meson-install 9bd7faa9472bf40f
0 1513 0 meson-install 9bd7faa9472bf40f
0 17 1548608119 src/organizer.gresource 78c4809cb7171ed0
0 1597 0 meson-install 9bd7faa9472bf40f
0 18 1548608177 src/organizer.gresource 78c4809cb7171ed0
0 1497 0 meson-install 9bd7faa9472bf40f
0 17 1548608879 src/organizer.gresource 78c4809cb7171ed0
0 1574 0 meson-install 9bd7faa9472bf40f
1 1544 0 meson-install 9bd7faa9472bf40f
0 18 1548608954 src/organizer.gresource 78c4809cb7171ed0
0 1474 0 meson-install 9bd7faa9472bf40f
0 1565 0 meson-install 9bd7faa9472bf40f
0 25 1548609444 src/organizer.gresource 78c4809cb7171ed0
0 2043 0 meson-install 9bd7faa9472bf40f
0 38 1549015121 src/organizer.gresource 78c4809cb7171ed0
1 2553 0 meson-install 9bd7faa9472bf40f
0 37 1549015309 src/organizer.gresource 78c4809cb7171ed0
0 2200 0 meson-install 9bd7faa9472bf40f
0 1775 0 meson-install 9bd7faa9472bf40f
0 1939 0 meson-install 9bd7faa9472bf40f
0 1679 0 meson-install 9bd7faa9472bf40f
0 19 1549022780 src/organizer.gresource 78c4809cb7171ed0
0 2068 0 meson-install 9bd7faa9472bf40f
1 144 1549027139 src/organizer.gresource 78c4809cb7171ed0
0 2188 0 meson-install 9bd7faa9472bf40f
0 1577 0 meson-install 9bd7faa9472bf40f
1 1535 0 meson-install 9bd7faa9472bf40f
0 1506 0 meson-install 9bd7faa9472bf40f
0 17 1549027401 src/organizer.gresource 78c4809cb7171ed0
0 1499 0 meson-install 9bd7faa9472bf40f
0 80 1549028261 src/organizer.gresource 78c4809cb7171ed0
0 2208 0 meson-install 9bd7faa9472bf40f
0 1540 0 meson-install 9bd7faa9472bf40f
0 1541 0 meson-install 9bd7faa9472bf40f
0 1417 0 meson-install 9bd7faa9472bf40f
0 1407 0 meson-install 9bd7faa9472bf40f
0 16 1548643001 src/organizer.gresource 78c4809cb7171ed0
0 1380 0 meson-install 9bd7faa9472bf40f
0 14 1548643566 src/organizer.gresource 78c4809cb7171ed0
0 2131 0 meson-install 9bd7faa9472bf40f
0 1498 0 meson-install 9bd7faa9472bf40f
0 1484 0 meson-install 9bd7faa9472bf40f
0 1511 0 meson-install 9bd7faa9472bf40f
0 1489 0 meson-install 9bd7faa9472bf40f
0 1467 0 meson-install 9bd7faa9472bf40f
0 15 1548643626 src/organizer.gresource 78c4809cb7171ed0
0 1482 0 meson-install 9bd7faa9472bf40f
0 1471 0 meson-install 9bd7faa9472bf40f
0 1459 0 meson-install 9bd7faa9472bf40f
0 1526 0 meson-install 9bd7faa9472bf40f
0 1508 0 meson-install 9bd7faa9472bf40f
0 1522 0 meson-install 9bd7faa9472bf40f
0 1465 0 meson-install 9bd7faa9472bf40f
0 1465 0 meson-install 9bd7faa9472bf40f
0 1474 0 meson-install 9bd7faa9472bf40f
0 1464 0 meson-install 9bd7faa9472bf40f
0 1457 0 meson-install 9bd7faa9472bf40f
0 1460 0 meson-install 9bd7faa9472bf40f
0 17 1549030586 src/organizer.gresource 78c4809cb7171ed0
0 1542 0 meson-install 9bd7faa9472bf40f
0 1695 0 meson-install 9bd7faa9472bf40f
0 1605 0 meson-install 9bd7faa9472bf40f
0 1579 0 meson-install 9bd7faa9472bf40f
0 1513 0 meson-install 9bd7faa9472bf40f
0 1560 0 meson-install 9bd7faa9472bf40f
0 1709 0 meson-install 9bd7faa9472bf40f
0 1586 0 meson-install 9bd7faa9472bf40f
0 2514 0 meson-install 9bd7faa9472bf40f
0 1612 0 meson-install 9bd7faa9472bf40f
1 1480 0 meson-install 9bd7faa9472bf40f
0 1619 0 meson-install 9bd7faa9472bf40f
0 1579 0 meson-install 9bd7faa9472bf40f
0 1663 0 meson-install 9bd7faa9472bf40f
0 1561 0 meson-install 9bd7faa9472bf40f
0 68 1549042223 src/organizer.gresource 78c4809cb7171ed0
0 1789 0 meson-install 9bd7faa9472bf40f
0 19 1549042556 src/organizer.gresource 78c4809cb7171ed0
0 1834 0 meson-install 9bd7faa9472bf40f
0 1652 0 meson-install 9bd7faa9472bf40f
0 22 1549043605 src/organizer.gresource 78c4809cb7171ed0
0 1529 0 meson-install 9bd7faa9472bf40f
1 1543 0 meson-install 9bd7faa9472bf40f
0 1464 0 meson-install 9bd7faa9472bf40f
0 1523 0 meson-install 9bd7faa9472bf40f
0 1494 0 meson-install 9bd7faa9472bf40f
0 1479 0 meson-install 9bd7faa9472bf40f
0 1427 0 meson-install 9bd7faa9472bf40f
0 1475 0 meson-install 9bd7faa9472bf40f
0 1464 0 meson-install 9bd7faa9472bf40f
0 42 1549077850 src/organizer.gresource 78c4809cb7171ed0
0 2010 0 meson-install 9bd7faa9472bf40f
0 1609 0 meson-install 9bd7faa9472bf40f
0 1441 0 meson-install 9bd7faa9472bf40f
0 1486 0 meson-install 9bd7faa9472bf40f
0 1454 0 meson-install 9bd7faa9472bf40f
0 1518 0 meson-install 9bd7faa9472bf40f
0 1559 0 meson-install 9bd7faa9472bf40f
0 1567 0 meson-install 9bd7faa9472bf40f
0 1537 0 meson-install 9bd7faa9472bf40f
......@@ -27,6 +27,7 @@ from .window import OrganizerWindow
class Application(Gtk.Application):
def __init__(self):
# TODO: change ID and remove "org.gnome"
super().__init__(application_id='org.gnome.Organizer',
flags=Gio.ApplicationFlags.FLAGS_NONE)
......
......@@ -2,5 +2,6 @@
<gresources>
<gresource prefix="/org/gnome/Organizer">
<file>window.ui</file>
<file>row.ui</file>
</gresource>
</gresources>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListBoxRow" id="file_row">
<property name="height_request">44</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selectable">False</property>
<child>
<object class="GtkLabel" id="filename_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">Safe Name</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
</interface>
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.22.1 -->
<interface>
<requires lib="gtk+" version="3.20"/>
<object class="GtkListBoxRow" id="file_row">
<property name="width_request">100</property>
<property name="height_request">44</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="selectable">False</property>
<child>
<object class="GtkLabel" id="filename_label">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label">Safe Name</property>
<property name="ellipsize">end</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
</object>
</interface>
......@@ -17,55 +17,113 @@
from gi.repository import Gtk, GLib
from .gi_composites import GtkTemplate
import sys, os, threading
import sys
import os
def threadless_print_filenames(directory):
for root, dirs, files in os.walk(directory):
for file in files:
print(os.path.join(root, file))
# array mapping each xdg folder with the GtkList options 1-6
def print_filenames(directory):
thread = threading.Thread(target=threadless_print_filenames(directory))
thread.start()
folders = [
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP),
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOCUMENTS),
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD),
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC),
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES),
GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_VIDEOS),
os.path.expanduser('~'),
]
folders=[GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DESKTOP), GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOCUMENTS), GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_DOWNLOAD), GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_MUSIC), GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES), GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_VIDEOS), os.path.expanduser('~')]
#@GtkTemplate("/org/gnome/Organizer/row.ui")
#class file_row(Gtk.ListBoxRow):
# file_row = GtkTemplate.Child()
# filename_label = GtkTemplate.Child()
# def filerow(self, name):
# self.filename_label.set_text(name)
# return(file_row)
@GtkTemplate(ui='/org/gnome/Organizer/window.ui')
@GtkTemplate("/org/gnome/Organizer/window.ui")
class OrganizerWindow(Gtk.ApplicationWindow):
gtk_stack = GtkTemplate.Child()
stack_2 = GtkTemplate.Child()
go_back = GtkTemplate.Child()
start_screen = GtkTemplate.Child()
all_location_list = GtkTemplate.Child()
__gtype_name__ = 'OrganizerWindow'
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.init_template()
def go_back_clicked_cb(self, button):
self.go_back.hide()
self.gtk_stack.set_visible_child(self.start_screen)
# About menu!
def on_about_button_clicked(self, button):
print("about clicked")
dialog = Gtk.AboutDialog()
dialog.set_modal(True)
dialog.set_authors(["Avi Wadhwa"])
dialog.set_authors(['Avi Wadhwa'])
dialog.set_artists(["lol there's no artwork"])
# TODO: get icon
dialog.set_logo_icon_name(None)
dialog.set_license_type(Gtk.License.GPL_3_0)
dialog.set_program_name(_("Organizer"))
dialog.set_translator_credits(_("translator-credits"))
dialog.set_version("0.1")
dialog.set_comments(_("Organizes your files"))
dialog.set_website("https://gitlab.gnome.org/aviwad/organizer")
dialog.set_program_name(_('Organizer'))
dialog.set_translator_credits(_('translator-credits'))
dialog.set_version('0.1')
dialog.set_comments(_('Organizes your files'))
dialog.set_website('https://gitlab.gnome.org/aviwad/organizer')
dialog.run()
dialog.destroy()
# When any location is clicked on homescreen
def row_activated(self, widget, row):
# Unhide the back button
self.go_back.show()
row_index = row.get_index()
#if row.get_index() is 7 then open filechooser
if (row_index == 7):
directory_chooser = Gtk.FileChooserDialog("Please choose a folder", None,
Gtk.FileChooserAction.SELECT_FOLDER,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL,
"Select", Gtk.ResponseType.OK))
directory_chooser.run()
# Open filechooser if "other" option clicked
if row_index == 7:
directory_chooser = \
Gtk.FileChooserDialog('Please choose a folder', None,
Gtk.FileChooserAction.SELECT_FOLDER,
(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, 'Select'
, Gtk.ResponseType.OK))
response = directory_chooser.run()
if response == Gtk.ResponseType.OK:
response_type = True
else:
response_type = False
directory_chooser.set_modal = True
# Get foldername and then close the filechooser
directory = directory_chooser.get_filename()
directory_chooser.destroy()
print_filenames(directory)
else:
# Get foldername from respective folder array index
directory = folders[row_index]
print(directory)
print_filenames(directory)
#otherwise set respective location per index
response_type = True
if response_type:
# TODO: do something with the folder
files = []
label_name = ''
for entry in os.scandir(directory):
if entry.is_file() and entry.name.startswith('.') == False:
#TODO move files to different categories
files.append(entry)
row = Gtk.Builder()
row.add_objects_from_resource("/org/gnome/Organizer/row.ui", ("file_row", "filename_label"))
file_row = row.get_object("file_row")
filename_label = row.get_object("filename_label")
filename_label.set_text(entry.name)
self.all_location_list.add(file_row)
label_name = label_name + ' \n ' + entry.name
self.gtk_stack.set_visible_child(self.stack_2)
# TODO fix label looks
# self.file_list_label.set_text(label_name)
This diff is collapsed.
This diff is collapsed.
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment