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

gui: Show project name and path form if name argument is present, not ju... #248

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 16 additions & 10 deletions devassistant/gui/path_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ def __init__(self, parent, main_window, builder, gui_helper):
self.label_full_prj_dir = self.builder.get_object("labelFullPrjDir")
self.h_separator = self.builder.get_object("hseparator")
self.top_assistant = None
self.name_arg_present = False
self.project_name_shown = True
self.current_main_assistant = None
self.data = dict()
Expand Down Expand Up @@ -93,15 +94,15 @@ def next_window(self, widget, data=None):
full_name = self.get_full_dir_name()

# check whether project directory and name is properly set
if not deps_only and self.current_main_assistant.name == 'crt':
if not deps_only and self.name_arg_present:
if project_dir == "":
return self.gui_helper.execute_dialog("Specify directory for project")
else:
# check whether directory is existing
if not os.path.isdir(project_dir):
response = self.gui_helper.create_question_dialog(
"Directory {0} does not exists".format(project_dir),
"Do you want to create them?"
"Directory {0} does not exist".format(project_dir),
"Do you want to create it?"
)
if response == Gtk.ResponseType.NO:
# User do not want to create a directory
Expand All @@ -118,7 +119,7 @@ def next_window(self, widget, data=None):
if not self._build_flags():
return

if not deps_only and self.current_main_assistant.name == 'crt':
if not deps_only and self.name_arg_present:
self.kwargs['name'] = full_name

self.data['kwargs'] = self.kwargs
Expand Down Expand Up @@ -187,26 +188,31 @@ def open_window(self, data=None):
self.current_main_assistant = data.get('current_main_assistant', None)
self.kwargs = data.get('kwargs', None)
self.data['debugging'] = data.get('debugging', False)

# get selectected assistants, but without TopAssistant itself
path = self.top_assistant.get_selected_subassistant_path(**self.kwargs)[1:]
# Check if 'name' argument is present
self.name_arg_present = [x for x in path[-1].args if x.name == "name"]

# initialize project name and path form
text = config_manager.get_config_value("da.project_dir") or self.get_user_path()
self.dir_name.set_text(text)
self.label_full_prj_dir.set_text(text)
self.dir_name.set_sensitive(True)
self.dir_name_browse_btn.set_sensitive(True)
self._remove_widget_items()
if self.current_main_assistant.name != 'crt' and self.project_name_shown:
if not self.name_arg_present and self.project_name_shown:
self.box6.remove(self.box_project)
self.project_name_shown = False
elif self.current_main_assistant.name == 'crt' and not self.project_name_shown:
elif self.name_arg_present and not self.project_name_shown:
self.box6.remove(self.box_path_main)
self.box6.pack_start(self.box_project, False, False, 0)
self.box6.pack_end(self.box_path_main, False, False, 0)
self.project_name_shown = True

caption_text = "Project: "
row = 0
# get selectected assistants, but without TopAssistant itself
path = self.top_assistant.get_selected_subassistant_path(**self.kwargs)[1:]
caption_parts = []

row = 0
# Finds any dependencies
found_deps = [x for x in path if x.dependencies()]
# This bool variable is used for showing text "Available options:"
Expand Down