Skip to content
This repository has been archived by the owner on Nov 10, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/v0.1.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Nunes committed Apr 5, 2016
2 parents 360a974 + 2e146b1 commit 4efaffb
Show file tree
Hide file tree
Showing 34 changed files with 1,158 additions and 324 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# Changelog

0.1.0 (2016-04-03)

* Users can now open and save FOMOD installers.
* Main windows title now shows which package you are currently working on.

----------------------------------

0.0.1 (2016-03-15)

* GUI draft completed.
File renamed without changes.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# FOMOD Designer
[![Build status](https://ci.appveyor.com/api/projects/status/nep4id3ammekof68?svg=true)](https://ci.appveyor.com/project/GandaG/fomod-editor)

*A visual editor to quickly create .fomod installers for Nexus based mods.*
*A visual editor to quickly create FOMOD installers for Nexus based mods.*

## Overview

Expand All @@ -14,7 +15,11 @@

## Usage

*TODO*
* Open the application;
* Click on the **New/Open** button;
* Select the root folder of your package (where the files you'll install are);
* Create/modify your installer;
* Once you're ready, click on the **Save** button to save your installer.

## Contributing

Expand Down
2 changes: 1 addition & 1 deletion Vagrantfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

Vagrant.configure(2) do |config|
config.vm.define "ubuntu", primary: true do |ubuntu|
ubuntu.vm.box = "ubuntu/wily64"
ubuntu.vm.box = "ubuntu/trusty64"
ubuntu.vm.provision :shell, :path => "dev/vagrant-ubuntu-bootstrap.sh", :privileged => false
end

Expand Down
8 changes: 1 addition & 7 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
install:
- set PATH=C:\Miniconda-x64;C:\Miniconda-x64\Scripts;%PATH%
- conda create -y -n fomod-editor -c https://conda.anaconda.org/mmcauliffe -c https://conda.anaconda.org/anaconda pyqt5=5.5.1 python=3.5.1 lxml=3.5.0
- activate fomod-editor
- pip install pip -U
- pip install setuptools -U
- pip install -r reqs.txt
- .\dev\appveyor-bootstrap.bat

build: off

Expand All @@ -21,5 +16,4 @@ deploy:
artifact: 'dist\*.zip'
force_update: true
on:
branch: master
appveyor_repo_tag: true
12 changes: 12 additions & 0 deletions dev/appveyor-bootstrap.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
@echo off

set PATH=C:\Miniconda-x64;C:\Miniconda-x64\Scripts;%PATH%

conda create -y -n fomod-editor^
-c https://conda.anaconda.org/mmcauliffe -c https://conda.anaconda.org/anaconda^
pyqt5=5.5.1 python=3.5.1 lxml=3.5.0
call activate fomod-editor

pip install pip -U
pip install setuptools -U --ignore-installed
pip install -r dev\reqs.txt
8 changes: 6 additions & 2 deletions build-linux.spec → dev/build-linux.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
block_cipher = None


a = Analysis(['dev/pyinstaller-bootstrap.py'],
a = Analysis(['pyinstaller-bootstrap.py'],
pathex=['/vagrant'],
binaries=None,
datas=[('fomod/gui/logos', 'fomod/gui/logos')],
datas=[('../fomod/gui/logos', 'fomod/gui/logos'),
('../README.md', '.'),
('../LICENSE', '.'),
('../CHANGELOG.md', '.'),
('../CONTRIBUTING.md', '.'),],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
Expand Down
8 changes: 6 additions & 2 deletions build-windows.spec → dev/build-windows.spec
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,14 @@
block_cipher = None


a = Analysis(['dev\\pyinstaller-bootstrap.py'],
a = Analysis(['pyinstaller-bootstrap.py'],
pathex=['C:\\projects\\fomod-editor'],
binaries=None,
datas=[('./fomod/gui/logos', './fomod/gui/logos')],
datas=[('../fomod/gui/logos', 'fomod/gui/logos'),
('../README.md', '.'),
('../LICENSE', '.'),
('../CHANGELOG.md', '.'),
('../CONTRIBUTING.md', '.'),],
hiddenimports=[],
hookspath=[],
runtime_hooks=[],
Expand Down
7 changes: 5 additions & 2 deletions dev/pyinstaller-bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from fomod.__main__ import main
import sys
import os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))

if __name__ == '__main__':
main()
from fomod.__main__ import main # placed here so pycharm doesn't complain about import location
main()
1 change: 0 additions & 1 deletion reqs.txt → dev/reqs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
bumpversion==0.5.3
-e .
invoke==0.12.2
lxml==3.5.0
PyInstaller==3.1.1
18 changes: 16 additions & 2 deletions dev/vagrant-ubuntu-bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,20 @@

sudo apt-get update


# fix locale issues

{
echo 'export LANGUAGE=en_US.UTF-8'
echo 'export LANG=en_US.UTF-8'
echo 'export LC_ALL=en_US.UTF-8'
echo 'export LC_CTYPE="en_US.UTF-8"'
} >> /home/vagrant/.bashrc

locale-gen en_US.UTF-8
sudo dpkg-reconfigure locales


# get git - needed for pyenv

sudo apt-get install -y git git-flow
Expand Down Expand Up @@ -87,5 +101,5 @@ pyenv shell miniconda3-3.19.0/envs/fomod-editor

cd /vagrant || exit
pip install pip -U
pip install setuptools -U
pip install -r reqs.txt
pip install setuptools -U --ignore-installed
pip install -r dev/reqs.txt
2 changes: 1 addition & 1 deletion fomod/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
# See the License for the specific language governing permissions and
# limitations under the License.

__version__ = "0.0.1"
__version__ = "0.1.0"
10 changes: 1 addition & 9 deletions fomod/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.

from .gui import mainframe
from PyQt5 import QtWidgets
from .gui.main import main


def main():
import sys
app = QtWidgets.QApplication(sys.argv)
window = mainframe.MainFrame()
window.show()
sys.exit(app.exec_())

if __name__ == "__main__":
main()
121 changes: 121 additions & 0 deletions fomod/base.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
#!/usr/bin/env python

# Copyright 2016 Daniel Nunes
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .exceptions import (BaseInstanceException, WrongParentException, InstanceCreationException,
AddChildException, RemoveRequiredChildException, RemoveChildException,
TextNotAllowedException)


class ObjectBase(object):
def __init__(self, name, tag, allowed_instances, element,
allow_parent=True, default_text="", allow_text=False,
allowed_children=None, max_children=0, required_children=None,
properties=None, default_properties=None):
if type(self) is ObjectBase:
raise BaseInstanceException(self)

if not properties:
properties = {}
if not default_properties:
default_properties = {}
if not allowed_children:
allowed_children = ()
if not required_children:
required_children = ()

self.name = name
self.tag = tag
self.children = []
self.properties = properties
self.allowed_children = allowed_children
self.max_children = max_children
self.required_children = required_children
self.allow_text = allow_text
self.text = ""
self.element = element
self.allow_parent = allow_parent
self.parent = None
self.allowed_instances = allowed_instances

if default_text:
self.set_text(default_text)
if default_properties:
self.set_properties(default_properties)

def add_child(self, child):
if not child.allow_parent:
raise WrongParentException(child, self)

if child.allowed_instances:
instances = 0
for item in self.children:
if item is type(child):
instances += 1
if instances >= child.allowed_instances:
raise InstanceCreationException(child)

if type(child) in self.allowed_children and self.max_children and len(self.children) < self.max_children:
self.children.append(child)
child.parent = self
else:
raise AddChildException(child, self)

def remove_child(self, child):
if self.required_children and type(child) in self.required_children:
instances = 0
for item in self.children:
if type(item) in self.required_children:
instances += 1
if instances < 2:
raise RemoveRequiredChildException(child, self)

if child in self.children:
self.children.remove(child)
else:
raise RemoveChildException(child, self)

def set_text(self, text):
if self.allow_text:
self.text = text
else:
raise TextNotAllowedException(self)

def set_properties(self, properties):
for key in properties:
if self.properties[key].editable and (properties[key] in self.properties[key].values or
isinstance(properties[key], str)):
self.properties[key].value = properties[key]

def iter(self):
list = [self]

for child in self.children:
list.extend(child.iter())

return list


class PropertyBase(object):
def __init__(self, name, tag, values, editable=True):
if type(self) is PropertyBase:
raise BaseInstanceException(self)

self.name = name
self.tag = tag
self.editable = editable

self.value = ""
self.values = values
Loading

0 comments on commit 4efaffb

Please sign in to comment.