Popup window template started

This commit is contained in:
Maxim Stewart 2019-06-29 22:50:29 -05:00
parent 2904e14d3f
commit cdf9dfd379
3 changed files with 159 additions and 148 deletions

View File

@ -31,19 +31,13 @@ class Controller:
newPath = widget.get_filename()
Grid(self.desktop, self.settings, newPath)
def getWindowsOnScreen(self):
screen = self.settings.returnScren()
windowButtons = self.builder.get_object("windowButtons")
def closePopup(self, widget, data=None):
widget.hide()
# File control events
@ -69,6 +63,7 @@ class Controller:
def pasteFile(self):
pass
# Webview events
def showWebview(self, widget):
self.builder.get_object("webViewer").popup()

View File

@ -8,132 +8,15 @@
<mime-type>inode/directory</mime-type>
</mime-types>
</object>
<object class="GtkImage" id="webDropDown">
<property name="visible">True</property>
<object class="GtkWindow" id="iconControlsWindow">
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Show Mini Webbrowser</property>
<property name="stock">gtk-go-down</property>
<property name="icon_size">3</property>
</object>
<object class="GtkWindow" id="Window">
<property name="can_focus">False</property>
<property name="default_width">800</property>
<property name="default_height">600</property>
<property name="type_hint">desktop</property>
<property name="resizable">False</property>
<property name="modal">True</property>
<property name="decorated">False</property>
<property name="gravity">center</property>
<signal name="focus-out-event" handler="closePopup" swapped="no"/>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="width_request">256</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="popOutBttn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">webDropDown</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="showWebview" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="filter">Folders</property>
<property name="title" translatable="yes">Directory Chooser</property>
<signal name="file-set" handler="setIconViewDir" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="searDir">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkIconView" id="Desktop">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">6</property>
<property name="selection_mode">multiple</property>
<property name="columns">6</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkBox" id="windowButtons">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkPopover" id="iconControlsWindow">
<property name="can_focus">False</property>
<property name="relative_to">popOutBttn</property>
<property name="position">bottom</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
@ -229,6 +112,132 @@
</object>
</child>
</object>
<object class="GtkImage" id="webDropDown">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="tooltip_text" translatable="yes">Show Mini Webbrowser</property>
<property name="stock">gtk-go-down</property>
<property name="icon_size">3</property>
</object>
<object class="GtkWindow" id="Window">
<property name="can_focus">False</property>
<property name="default_width">800</property>
<property name="default_height">600</property>
<property name="type_hint">desktop</property>
<property name="decorated">False</property>
<property name="gravity">center</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox" id="box1">
<property name="width_request">256</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkButton" id="popOutBttn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="image">webDropDown</property>
<property name="always_show_image">True</property>
<signal name="clicked" handler="showWebview" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkFileChooserButton" id="selectedDirDialog">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="action">select-folder</property>
<property name="filter">Folders</property>
<property name="title" translatable="yes">Directory Chooser</property>
<signal name="file-set" handler="setIconViewDir" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkSearchEntry" id="searDir">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="primary_icon_name">edit-find-symbolic</property>
<property name="primary_icon_activatable">False</property>
<property name="primary_icon_sensitive">False</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkMenuButton" id="controlsBttn">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="focus_on_click">False</property>
<property name="receives_default">True</property>
<property name="relief">none</property>
<property name="use_popover">False</property>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<child>
<object class="GtkViewport">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkIconView" id="Desktop">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="margin">6</property>
<property name="selection_mode">multiple</property>
<property name="columns">6</property>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkPopover" id="webViewer">
<property name="can_focus">False</property>
<property name="hexpand">True</property>

View File

@ -140,6 +140,7 @@ class Grid:
# print(data)
def iconLeftClickEventManager(self, widget, item):
print(item)
try:
model = widget.get_model()
fileName = model[item][1]
@ -160,27 +161,33 @@ class Grid:
except Exception as e:
print(e)
def iconRightClickEventManager(self, widget, eve, params):
def iconRightClickEventManager(self, widget, eve, rclicked_icon):
try:
if eve.type == gdk.EventType.BUTTON_PRESS and eve.button == 3:
popover = self.builder.get_object("iconControlsWindow")
popover.show_all()
popover.popup()
# # NOTE: Need to change name of listview box...
# children = widget.get_children()[0].get_children()
# fileName = children[1].get_text()
# dir = self.currentPath
# file = dir + "/" + fileName
#
# input = self.builder.get_object("iconRenameInput")
# popover = self.builder.get_object("iconControlsWindow")
# self.selectedFile = file # Used for return to caller
#
# input.set_text(fileName)
# popover.set_relative_to(widget)
# popover.set_position(gtk.PositionType.RIGHT)
# popover.show_all()
# popover.popup()
input = self.builder.get_object("iconRenameInput")
controls = self.builder.get_object("iconControlsWindow")
items = widget.get_selected_items()
model = widget.get_model()
if len(items) == 1:
fileName = model[items[0]][1]
dir = self.currentPath
file = dir + "/" + fileName
self.selectedFile = file # Used for return to caller
input.set_text(fileName)
controls.show_all()
if len(items) > 1:
dir = self.currentPath
for item in items:
fileName = model[item][1]
file = dir + "/" + fileName
print(file)
input.set_text("")
input.hide()
controls.show()
except Exception as e:
print(e)