Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
73e66ba
Added new exit dialog.
JamesWrigley Aug 23, 2014
b4edbc8
Some code cleanups.
JamesWrigley Aug 24, 2014
0089ca5
Moar cleanups.
JamesWrigley Aug 31, 2014
1c044a2
Initial commit for a new file viewer dialog, not properly hooked up y…
JamesWrigley Sep 3, 2014
83e5d21
Added support for image previews (when possible).
JamesWrigley Sep 3, 2014
1207194
Merge remote-tracking branch 'origin/develop' into dialogs
JamesWrigley Sep 3, 2014
97d2151
Minor fix to remove the 'file://' prefix from the path bar.
JamesWrigley Sep 3, 2014
c789763
Hooked up the new file dialog to open when saving a new graph.
JamesWrigley Sep 4, 2014
8a7e562
Fixed buttleData.saveData(), previously it would save in the current …
JamesWrigley Sep 4, 2014
1b9ca13
The QUrl stuff was messing things up. Note: with this change, we'll h…
JamesWrigley Sep 5, 2014
30b3108
The file dialog now displays the filename of the selected file in the…
JamesWrigley Sep 5, 2014
bed9796
Switched finderLoadGraph to be a FileViewerDialog. The whole open/sav…
JamesWrigley Sep 5, 2014
6bca292
General improvements to the file dialog: It now opens at the users ho…
JamesWrigley Sep 6, 2014
a03e859
Moved visible property from ExitDialog.qml to the dialogs themselves …
JamesWrigley Sep 6, 2014
7789f09
Replaced the openGraph dialog with an ExitDialog, removed the abortBu…
JamesWrigley Sep 8, 2014
425aa8b
Added comment, and switched to using a FileViewerDialog for openGraph.
JamesWrigley Sep 9, 2014
605e16e
Reverted 1b9ca13.
JamesWrigley Sep 13, 2014
ece3a33
Rewrote the showDialog signals to send a string describing the action…
JamesWrigley Sep 13, 2014
6cc09b4
Some cleanups for the dialogs. Of particular note, the message in Exi…
JamesWrigley Sep 22, 2014
6639c29
Simplified the way we assign the current folder to the URL bar. Todo:…
JamesWrigley Oct 3, 2014
396aad9
And at long last, a fix for the bug that started it all, #72 :P
JamesWrigley Oct 4, 2014
b1aab84
Simplified the ridiculous interation between dialogs, fixed a TODO so…
JamesWrigley Oct 13, 2014
747ad26
Replaced the QtQuick dialogs with our own.
JamesWrigley Oct 13, 2014
00b83ac
Removed modality property.
JamesWrigley Oct 13, 2014
ec4d869
Merge branch 'develop' into dialogs
JamesWrigley Jan 22, 2015
8353dbe
Whitespace cleanup to satisfy flake.
JamesWrigley Jan 22, 2015
1c9b9b3
Fixed bug that would hide the graph widget on startup. Seems to have
JamesWrigley Jan 22, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
241 changes: 124 additions & 117 deletions buttleofx/MainWindow.qml

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions buttleofx/data/buttleData.py
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,7 @@ def loadData(self, url='buttleofx/backup/data.bofx'):
"""
Loads all data from a Json file (the default Json file if no url is given)
"""

filepath = QtCore.QUrl(url).toLocalFile()

self.newData()

with open(filepath, 'r') as f:
Expand Down Expand Up @@ -649,11 +647,11 @@ def saveData(self, url):
"""
Saves all data in a json file
"""
# If called from Python, it could be a str or a QUrl
if isinstance(url, str):
# If called from Python, it could be a str or a QUrl.
filepath = QtCore.QUrl.fromLocalFile(url).toLocalFile()
filepath = url
else:
filepath = QtCore.QUrl(url).toLocalFile()
filepath = url.toLocalFile()

if not filepath.lower().endswith(".bofx"):
filepath = filepath + ".bofx"
Expand Down Expand Up @@ -739,6 +737,9 @@ def zoom(self, width, height, nodeWidth, zoomCoeff, graphPreviousWidth, graphPre
def getButtlePath(self):
return self._buttlePath

def getHomeDir(self):
return os.path.expanduser("~")

def getCurrentConnectionWrapper(self):
"""
Returns the current currentConnectionWrapper.
Expand Down Expand Up @@ -1039,6 +1040,7 @@ def graphCanBeSaved(self):

# filePath
buttlePath = QtCore.pyqtProperty(str, getButtlePath, constant=True)
homeDir = QtCore.pyqtProperty(str, getHomeDir, constant=True)

# Current param, view, and selected node
currentParamNodeChanged = QtCore.pyqtSignal()
Expand Down
90 changes: 90 additions & 0 deletions buttleofx/gui/dialogs/ExitDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import QtQuick 2.1
import QtQuick.Window 2.1
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0

Window {
id: exitDialog
width: 425
height: 100
title: "Save Changes?"
color: "#141414"
flags: Qt.Dialog

property string dialogText: "Do you want to save before exiting?<br>If you don't, all unsaved changes will be lost."

signal saveButtonClicked
signal discardButtonClicked

Component {
id: buttonStyle

ButtonStyle {
background: Rectangle {
radius: 6
implicitWidth: 100
implicitHeight: 25

border.color: control.hovered ? "#00B2A1" : "#9F9C99"
border.width: control.hovered ? 3 : 2

gradient: Gradient {
GradientStop { position: 0; color: control.pressed ? "#EFEBE7" : "#EFEBE7" }
GradientStop { position: .5; color: control.pressed ? "#D9D9D9" : "#EFEBE7" }
GradientStop { position: 0; color: control.pressed ? "#EFEBE7" : "#EFEBE7" }
}
}
}
}

ColumnLayout {
anchors.centerIn: parent
spacing: 15

RowLayout {
spacing: 20

Image { source: "../img/icons/logo_icon.png" }

Text {
text: dialogText
color: "#FEFEFE"
}
}

RowLayout {
anchors.horizontalCenter: parent.horizontalCenter
spacing: 6

Button {
id: saveButton
text: "Save"
style: buttonStyle

onClicked: {
exitDialog.saveButtonClicked()
exitDialog.visible = false
}
}

Button {
id: discardButton
text: "Discard"
style: buttonStyle

onClicked: {
exitDialog.discardButtonClicked()
exitDialog.visible = false
}
}

Button {
id: abortButton
text: "Abort"
style: buttonStyle
onClicked: exitDialog.visible = false
}
}
}
}
206 changes: 206 additions & 0 deletions buttleofx/gui/dialogs/FileViewerDialog.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,206 @@
import QtQuick 2.1
import QtQuick.Window 2.1
import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.0
import Qt.labs.folderlistmodel 2.1

Window {
id: fileViewerWindow
width: 630
height: 380
color: "#141414"
flags: Qt.Dialog

property string buttonText
property string folderModelFolder
property string entryBarText: entryBar.text

signal buttonClicked(string currentFile)

FolderListModel {
id: folderModel
showDirsFirst: true
folder: folderModelFolder
}

ColumnLayout {
anchors.fill: parent
anchors.margins: 4

RowLayout {
id: headerBar
anchors.top: parent.top
anchors.leftMargin: parent.spacing
anchors.rightMargin: parent.spacing

Button {
id: parentFolderButton
width: 15
height: 15

iconSource:
if (hovered) {
"../img/buttons/browser/parent_hover.png"
} else {
"../img/buttons/browser/parent.png"
}

style:
ButtonStyle {
background: Rectangle {
anchors.fill: parent
color: "transparent"
}
}

onClicked: {
folderModel.folder = folderModel.parentFolder
}
}

Rectangle {
Layout.fillWidth: true
height: 24
color: "black"
radius: 5
border.color: "grey"

TextInput {
id: urlBar
x: 5
y: 4

text: folderModel.folder.toString().substring(7)
readOnly: true
selectByMouse: true
Layout.fillWidth: true

color: "white"
selectionColor: "#00b2a1"
}
}
}

ScrollView {
anchors.top: headerBar.bottom
anchors.left: parent.left
anchors.right: parent.right
anchors.bottom: bottomRow.top
anchors.bottomMargin: 4

GridView {
id: folderView
model: folderModel
cellWidth: 100
cellHeight: 100
highlightFollowsCurrentItem: false

highlight: Rectangle {
width: folderView.cellWidth
height: folderView.cellHeight
color: "#00b2a1"
radius: 4

x: folderView.currentItem.x
y: folderView.currentItem.y
Behavior on x { SmoothedAnimation { duration: -1; velocity: -1 } }
Behavior on y { SmoothedAnimation { duration: -1; velocity: -1 } }
}

delegate: Rectangle {
width: folderView.cellWidth
height: folderView.cellHeight
color: "transparent"

Column {
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter

Image {
anchors.horizontalCenter: parent.horizontalCenter
width: 55
height: 55
asynchronous: true
fillMode: Image.PreserveAspectFit
sourceSize.width: width
sourceSize.height: height
property variant supportedFormats: ["bmp", "gif", "jpg", "jpeg", "png", "pbm", "pgm", "ppm", "xbm", "xpm"]

source: {
if (folderModel.isFolder(index)) {
"../img/buttons/browser/folder-icon.png"
} else if (supportedFormats.indexOf(folderModel.get(index, "fileSuffix").toLowerCase()) != -1) {
folderModel.get(index, "filePath")
} else {
"../img/buttons/browser/file-icon.png"
}
}
}

Text {
text: fileName
color: "white"
width: folderView.cellWidth - 10
horizontalAlignment: Text.AlignHCenter
wrapMode: Text.WrapAnywhere
}
}

MouseArea {
anchors.fill: parent

onClicked: {
folderView.currentIndex = index
if (!folderModel.isFolder(index)) {
entryBar.text = folderModel.get(index, "fileName")
} else {
entryBar.text = ""
}
}
onDoubleClicked: {
if (folderModel.isFolder(index)) {
folderModel.folder = folderModel.get(index, "filePath")
}
}
}
}
}
}

RowLayout {
id: bottomRow
Layout.fillWidth: true
Layout.fillHeight: true
anchors.bottom: parent.bottom

TextField {
id: entryBar
Layout.fillWidth: true
}

Button {
text: buttonText

style:
ButtonStyle {
background: Rectangle {
radius: 6
implicitWidth: 100
implicitHeight: 25

border.color: control.hovered ? "#00B2A1" : "#9F9C99"
border.width: control.hovered ? 3 : 2

gradient: Gradient {
GradientStop { position: 0; color: control.pressed ? "#EFEBE7" : "#EFEBE7" }
GradientStop { position: .5; color: control.pressed ? "#D9D9D9" : "#EFEBE7" }
GradientStop { position: 0; color: control.pressed ? "#EFEBE7" : "#EFEBE7" }
}
}
}
onClicked: fileViewerWindow.buttonClicked(folderModel.folder + "/" + entryBarText)
}
}
}
}
18 changes: 0 additions & 18 deletions buttleofx/gui/graph/qml/FinderLoadGraph.qml

This file was deleted.

19 changes: 0 additions & 19 deletions buttleofx/gui/graph/qml/FinderSaveGraph.qml

This file was deleted.

Loading