Restructured settings, updated css themeing
This commit is contained in:
parent
710d37f01d
commit
dc894f1245
@ -12,3 +12,4 @@ PyFM is a Gtk + Python file manager.
|
||||
|
||||
# Images
|
||||
![1 PyFM showing different directories. ](images/pic1.png)
|
||||
![1 PyFM themed dark and made transparent. ](images/pic2.png)
|
||||
|
BIN
images/pic2.png
Normal file
BIN
images/pic2.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 300 KiB |
@ -14,6 +14,7 @@ from __builtins__ import Builtins
|
||||
class Main(Builtins):
|
||||
def __init__(self, args):
|
||||
settings = Settings()
|
||||
settings.createWindow()
|
||||
|
||||
# Gets the methods from the classes and sets to handler.
|
||||
# Then, builder connects to any signals it needs.
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!-- Generated with glade 3.38.2 -->
|
||||
<interface>
|
||||
<requires lib="gtk+" version="3.20"/>
|
||||
<requires lib="gtk+" version="3.22"/>
|
||||
<object class="GtkAboutDialog" id="about_page">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="border-width">5</property>
|
||||
@ -966,6 +966,11 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti
|
||||
<property name="can-focus">False</property>
|
||||
<property name="pixbuf">icons/trash.png</property>
|
||||
</object>
|
||||
<object class="GtkImage" id="trash_img">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="icon-name">user-trash</property>
|
||||
</object>
|
||||
<object class="GtkDialog" id="context_menu">
|
||||
<property name="can-focus">False</property>
|
||||
<property name="window-position">mouse</property>
|
||||
@ -1001,102 +1006,13 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox" id="iconsButtonBox">
|
||||
<object class="GtkEntry" id="context_menu_fname">
|
||||
<property name="width-request">500</property>
|
||||
<property name="height-request">26</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child type="center">
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="name">delete</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Delete...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-cut</property>
|
||||
<property name="name">cut</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Cut...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-copy</property>
|
||||
<property name="name">copy</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Trash</property>
|
||||
<property name="name">trash</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Move to Trash...</property>
|
||||
<property name="image">trashImage</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-paste</property>
|
||||
<property name="name">paste</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Paste...</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="primary-icon-stock">gtk-edit</property>
|
||||
<property name="placeholder-text" translatable="yes">New File/Dir Name...</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
@ -1104,26 +1020,11 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkEntry" id="context_menu_fname">
|
||||
<property name="width-request">500</property>
|
||||
<property name="height-request">26</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="primary-icon-stock">gtk-edit</property>
|
||||
<property name="placeholder-text" translatable="yes">New File/Dir Name...</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="menuButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="margin-bottom">20</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child>
|
||||
<object class="GtkBox">
|
||||
@ -1200,6 +1101,110 @@ PyFM is developed on Atom, git, and using Python 3+ with Gtk GObject introspecti
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="iconsButtonBox">
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<child type="center">
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-delete</property>
|
||||
<property name="name">delete</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Delete...</property>
|
||||
<property name="margin-top">20</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-cut</property>
|
||||
<property name="name">cut</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Cut...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-copy</property>
|
||||
<property name="name">copy</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Copy...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label" translatable="yes">Trash</property>
|
||||
<property name="name">trash</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Move to Trash...</property>
|
||||
<property name="image">trash_img</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack-type">end</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton">
|
||||
<property name="label">gtk-paste</property>
|
||||
<property name="name">paste</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can-focus">True</property>
|
||||
<property name="receives-default">True</property>
|
||||
<property name="tooltip-text" translatable="yes">Paste...</property>
|
||||
<property name="use-stock">True</property>
|
||||
<property name="always-show-image">True</property>
|
||||
<signal name="button-release-event" handler="do_action_from_menu_controls" swapped="no"/>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">4</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
|
@ -1,21 +1,35 @@
|
||||
/* Set fm to have transparent window */
|
||||
|
||||
|
||||
box,
|
||||
iconview,
|
||||
notebook,
|
||||
paned,
|
||||
stack,
|
||||
scrolledwindow,
|
||||
treeview.view,
|
||||
.content-view,
|
||||
.view {
|
||||
background: rgba(19, 21, 25, 0.14);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
|
||||
/* * {
|
||||
background: rgba(0, 0, 0, 0.14);
|
||||
color: rgba(255, 255, 255, 1);
|
||||
}
|
||||
} */
|
||||
|
||||
* selection {
|
||||
/* * selection {
|
||||
background-color: rgba(116, 0, 0, 0.65);
|
||||
color: rgba(255, 255, 255, 0.5);
|
||||
}
|
||||
} */
|
||||
|
||||
|
||||
.view:selected,
|
||||
.view:selected:hover {
|
||||
box-shadow: inset 0 0 0 9999px rgba(15, 134, 13, 0.49);
|
||||
box-shadow: inset 0 0 0 9999px rgba(21, 158, 167, 0.57);
|
||||
color: rgba(255, 255, 255, 0.5);;
|
||||
} */
|
||||
}
|
||||
|
||||
|
||||
/* Rubberband coloring */
|
||||
|
@ -29,7 +29,7 @@ class Signals(WidgetFileActionMixin, PaneMixin, WindowMixin):
|
||||
self.window_controller = WindowController()
|
||||
self.state = self.window_controller.load_state()
|
||||
|
||||
self.window = self.builder.get_object("Main_Window")
|
||||
self.window = self.settings.getMainWindow()
|
||||
self.window1 = self.builder.get_object("window1")
|
||||
self.window2 = self.builder.get_object("window2")
|
||||
self.window3 = self.builder.get_object("window3")
|
||||
|
@ -17,35 +17,45 @@ from . import Logger
|
||||
class Settings:
|
||||
def __init__(self):
|
||||
self.SCRIPT_PTH = os.path.dirname(os.path.realpath(__file__))
|
||||
self.builder = gtk.Builder()
|
||||
self.gladefile = self.SCRIPT_PTH + "/../resources/Main_Window.glade"
|
||||
self.cssFile = self.SCRIPT_PTH + '/../resources/stylesheet.css'
|
||||
self.logger = Logger().get_logger()
|
||||
self.builder.add_from_file(self.SCRIPT_PTH + "/../resources/Main_Window.glade")
|
||||
|
||||
self.builder = gtk.Builder()
|
||||
self.builder.add_from_file(self.gladefile)
|
||||
self.mainWindow = None
|
||||
|
||||
|
||||
|
||||
def createWindow(self):
|
||||
# Get window and connect signals
|
||||
window = self.builder.get_object("Main_Window")
|
||||
window.connect("delete-event", gtk.main_quit)
|
||||
self.setWindowData(window, True)
|
||||
return window
|
||||
self.mainWindow = self.builder.get_object("Main_Window")
|
||||
self.setWindowData()
|
||||
|
||||
def setWindowData(self, window, paintable):
|
||||
screen = window.get_screen()
|
||||
def setWindowData(self):
|
||||
screen = self.mainWindow.get_screen()
|
||||
visual = screen.get_rgba_visual()
|
||||
|
||||
if visual != None and screen.is_composited():
|
||||
window.set_visual(visual)
|
||||
self.mainWindow.set_visual(visual)
|
||||
self.mainWindow.set_app_paintable(True)
|
||||
self.mainWindow.connect("draw", self.area_draw)
|
||||
|
||||
# bind css file
|
||||
cssProvider = gtk.CssProvider()
|
||||
cssProvider.load_from_path(self.SCRIPT_PTH + '/../resources/stylesheet.css')
|
||||
cssProvider.load_from_path(self.cssFile)
|
||||
screen = gdk.Screen.get_default()
|
||||
styleContext = gtk.StyleContext()
|
||||
styleContext.add_provider_for_screen(screen, cssProvider, gtk.STYLE_PROVIDER_PRIORITY_USER)
|
||||
|
||||
window.set_app_paintable(paintable)
|
||||
if paintable:
|
||||
window.connect("draw", self.area_draw)
|
||||
def area_draw(self, widget, cr):
|
||||
cr.set_source_rgba(0, 0, 0, 0.54)
|
||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||
cr.paint()
|
||||
cr.set_operator(cairo.OPERATOR_OVER)
|
||||
|
||||
def getMainWindow(self): return self.mainWindow
|
||||
|
||||
|
||||
def getMonitorData(self):
|
||||
screen = self.builder.get_object("Main_Window").get_screen()
|
||||
@ -57,9 +67,3 @@ class Settings:
|
||||
print("{}x{}+{}+{}".format(monitor.width, monitor.height, monitor.x, monitor.y))
|
||||
|
||||
return monitors
|
||||
|
||||
def area_draw(self, widget, cr):
|
||||
cr.set_source_rgba(0, 0, 0, 0.54)
|
||||
cr.set_operator(cairo.OPERATOR_SOURCE)
|
||||
cr.paint()
|
||||
cr.set_operator(cairo.OPERATOR_OVER)
|
||||
|
Loading…
Reference in New Issue
Block a user