Exemplo n.º 1
0
 def save_to_forwarder_json(self):
     filename = file_dialog(True, "Save Forwarder JSON File",
                            JSON_FILE_TYPES)
     if filename:
         provider_type, ok_pressed = QInputDialog.getItem(
             None,
             "Provider type",
             "Select provider type for PVs",
             ["ca", "pva"],
             0,
             False,
         )
         default_broker, ok_pressed = QInputDialog.getText(
             None,
             "Default broker",
             "Default Broker: (This will only be used for streams that do not already have a broker)",
             text="broker:port",
             echo=QLineEdit.Normal,
         )
         if ok_pressed:
             with open(filename, "w") as file:
                 nexus_constructor.json.forwarder_json_writer.generate_forwarder_command(
                     file,
                     self.instrument.nexus.entry,
                     provider_type=provider_type,
                     default_broker=default_broker,
                 )
Exemplo n.º 2
0
    def select_fps(self):
        if not self.parent.size_result.text():
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Critical)
            msg.setText("Error")
            msg.setInformativeText("Select size")
            msg.setWindowTitle("Error")
            msg.exec_()
            self.select_size()
            return True

        if self.parent.camtype == "usb_cam":
            width, height = map(str, self.parent.size_result.text().split("x"))
            items = self.parent.camera.get_supported_fps(
                self.parent.fourcc_result.text(), width, height)
        #elif self.camtype == "raspi":
        else:
            items = self.parent.raspicam_fps()

        item, ok = QInputDialog.getItem(self.dialog, "Select", "Select FPS",
                                        items, 0, False)
        if ok:
            self.parent.fps_result.setText(item)
        else:
            return None
Exemplo n.º 3
0
		def _changeAccess(self, index):
			item = index.internalPointer()
			text,good = QInputDialog.getItem(None, 'modify item access', 'choose new access type:', ['private', 'public'], current=item.access()==CollectionItem.AccessType.public, editable=False)
			if(not good):return
			newaccess=CollectionItem.AccessType.public if text=='public' else CollectionItem.AccessType.private
			if(newaccess==item.access()):return
			item.setAccess(newaccess)
Exemplo n.º 4
0
    def on_action_edit_euler_angle_convention(self):
        allowed_conventions = ['None', 'Extrinsic XYZ', 'Intrinsic ZXZ']
        current = HexrdConfig().euler_angle_convention
        ind = 0
        if current[0] is not None and current[1] is not None:
            for i, convention in enumerate(allowed_conventions):
                is_extr = 'Extrinsic' in convention
                if current[0].upper() in convention and current[1] == is_extr:
                    ind = i
                    break

        name, ok = QInputDialog.getItem(self.ui, 'HEXRD',
                                        'Select Euler Angle Convention',
                                        allowed_conventions, ind, False)

        if not ok:
            # User canceled...
            return

        if name == 'None':
            chosen = None
            extrinsic = None
        else:
            chosen = name.split()[1].lower()
            extrinsic = 'Extrinsic' in name

        HexrdConfig().set_euler_angle_convention(chosen, extrinsic)

        self.update_all()
        self.update_config_gui()
Exemplo n.º 5
0
    def _on_add_chapter_triggered(self):
        # Get the chapter to use as a base
        choices = self._create_chapter_choice_list()
        (choice, ok) = QInputDialog.getItem(self, "Select Base Chapter",
                                            "Base Chapter", choices)
        if not ok:
            return
        source_chapter = self._get_chapter_from_choice(choice, choices)

        # Get the desired CID.
        (desired_cid,
         ok) = QInputDialog.getText(self, "Enter a CID for the new chapter.",
                                    "CID")
        if not ok:
            return

        # Validate the CID.
        service = locator.get_scoped("ChapterService")
        if service.is_cid_in_use(desired_cid):
            self.error_dialog = ErrorDialog("The CID \"" + desired_cid +
                                            "\" is already in use.")
            self.error_dialog.show()
            return
        if not desired_cid.startswith("CID_"):
            self.error_dialog = ErrorDialog("CID must start with the \"CID_\"")
            self.error_dialog.show()
            return

        # Create the chapter
        service.create_chapter(source_chapter, desired_cid)
Exemplo n.º 6
0
 def on_add_fact_button_clicked(self):
     attr_map = OrderedDict((x.name, x) for x in self._contact.iter_attributes())
     attr_name, ok = QInputDialog.getItem(
         self, 'add fact', 'select an attribute', list(attr_map.keys()), editable=False)
     if ok:
         attr = attr_map[attr_name]
         self._add_row_to_grid(attr, fact=None)
Exemplo n.º 7
0
    def set_defult_class(self):
        # if yaml is provided (ex: in task)
        if hasattr(self, 'class_map'):
            class_list = []
            for cls_idx, cls_name in self.class_map.items():
                class_list.append(f"{cls_idx}-{cls_name}")
            # show a dialog
            dialog = QInputDialog()
            label_text = "Input the correct class number.\n"\
                "Please note your input will not be checked for legality"
            item, okPressed = \
                QInputDialog.getItem(dialog, \
                "Edit class", \
                label_text, \
                class_list, False)
            # print(text, okPressed)
            if okPressed and item:
                class_idx = int(item.split('-')[0])
                self.current_dataScene.last_cls = class_idx
                ADS_config.DEFAULT_CLS = class_idx

        else:
            dialog = QInputDialog()
            label_text = "Input the correct class number.\n"\
                "Please note your input will not be checked for legality"
            text, okPressed = \
                QInputDialog.getText(dialog, \
                "Edit class", \
                label_text, \
                QLineEdit.Normal)

            if okPressed and text != '':
                self.current_dataScene.last_cls = int(text)
                ADS_config.DEFAULT_CLS = int(text)
Exemplo n.º 8
0
    def select_size(self):
        if not self.parent.fourcc_result.text():
            msg = QMessageBox()
            msg.setIcon(QMessageBox.Critical)
            msg.setText("Error")
            msg.setInformativeText("Select fourcc")
            msg.setWindowTitle("Error")
            msg.exec_()
            self.select_fourcc()
            return True

        if self.parent.camtype == "usb_cam":
            items = self.parent.camera.get_supported_size(self.parent.fourcc_result.text())
        #elif self.camtype == "raspi":
        else:
            items = self.parent.camera.raspicam_img_format()

        item, ok = QInputDialog.getItem(
            self.dialog,
            "Select",
            "Select Size",
            items, 0, False
        )
        if ok:
            self.parent.size_result.setText(item)
        else:
            return None
Exemplo n.º 9
0
    def on_action_edit_euler_angle_convention(self):
        allowed_conventions = ['None', 'Extrinsic XYZ', 'Intrinsic ZXZ']
        corresponding_values = [
            None, {
                'axes_order': 'xyz',
                'extrinsic': True
            }, {
                'axes_order': 'zxz',
                'extrinsic': False
            }
        ]
        current = HexrdConfig().euler_angle_convention
        ind = corresponding_values.index(current)

        name, ok = QInputDialog.getItem(self.ui, 'HEXRD',
                                        'Select Euler Angle Convention',
                                        allowed_conventions, ind, False)

        if not ok:
            # User canceled...
            return

        chosen = corresponding_values[allowed_conventions.index(name)]
        HexrdConfig().set_euler_angle_convention(chosen)

        self.update_all()
        self.update_config_gui()
Exemplo n.º 10
0
 def select_fourcc(self):
     items = self.parent.camera.get_supported_fourcc()
     item, ok = QInputDialog.getItem(self.dialog, "Select", "Select Fourcc",
                                     items, 0, False)
     if ok:
         self.parent.fourcc_result.setText(item)
     else:
         return None
Exemplo n.º 11
0
 def multiChoice(self, choices):
     '''Create a dialog with the choices and show it to the player'''
     choicesAsList = [x for x in choices]
     text, ok = QInputDialog.getItem(self,
                                     self.tr("QInputDialog().getText()"),
                                     self.tr("User name:"), choicesAsList)
     if text and ok:
         print(text)
Exemplo n.º 12
0
def getItem(parentWindow=None,
            title="Item Selection",
            label="Item:",
            items=["t0", "t1"],
            current=0,
            editable=True):
    return QInputDialog.getItem(parentWindow, title, label, items, current,
                                editable)
Exemplo n.º 13
0
 def remove_bookmark(self, evt):
     bookmarks = list(self._person.map.bookmarks)
     reprs = [_("{name}: longitude: {longitude}, latitude: {latitude}").format(name=b.name, longitude=b.longitude, latitude=b.latitude) for b in bookmarks]
     repr, ok = QInputDialog.getItem(self._main_window, _("Data entry"), _("Select a bookmark"), reprs, editable=False)
     if not ok:
         return
     bookmark = bookmarks[reprs.index(repr)]
     if QMessageBox.question(self._main_window, _("Question"), _("Do you really want to delete the bookmark {name}?").format(name=bookmark.name)) == QMessageBox.Yes:
         map().remove_bookmark(bookmark)
Exemplo n.º 14
0
    def on_action_save_imageseries_triggered(self):
        if not HexrdConfig().has_images():
            msg = ('No ImageSeries available for saving.')
            QMessageBox.warning(self.ui, 'HEXRD', msg)
            return

        if ImageLoadManager().unaggregated_images:
            ims_dict = ImageLoadManager().unaggregated_images
        else:
            ims_dict = HexrdConfig().imageseries_dict

        if len(ims_dict) > 1:
            # Have the user choose an imageseries to save
            names = list(ims_dict.keys())
            name, ok = QInputDialog.getItem(self.ui, 'HEXRD',
                                            'Select ImageSeries', names, 0,
                                            False)
            if not ok:
                # User canceled...
                return
        else:
            name = list(ims_dict.keys())[0]

        selected_file, selected_filter = QFileDialog.getSaveFileName(
            self.ui, 'Save ImageSeries',
            HexrdConfig().working_dir,
            'HDF5 files (*.h5 *.hdf5);; NPZ files (*.npz)')

        if selected_file:
            HexrdConfig().working_dir = os.path.dirname(selected_file)
            if selected_filter.startswith('HDF5'):
                selected_format = 'hdf5'
            elif selected_filter.startswith('NPZ'):
                selected_format = 'frame-cache'

            kwargs = {}
            if selected_format == 'hdf5':
                # A path must be specified. Set it ourselves for now.
                kwargs['path'] = 'imageseries'
            elif selected_format == 'frame-cache':
                # Get the user to pick a threshold
                result, ok = QInputDialog.getDouble(self.ui, 'HEXRD',
                                                    'Choose Threshold', 10, 0,
                                                    1e12, 3)
                if not ok:
                    # User canceled...
                    return

                kwargs['threshold'] = result

                # This needs to be specified, but I think it just needs
                # to be the same as the file name...
                kwargs['cache_file'] = selected_file

            HexrdConfig().save_imageseries(ims_dict.get(name), name,
                                           selected_file, selected_format,
                                           **kwargs)
Exemplo n.º 15
0
def import_seisware_data(self):

    projects = SWprojlist()

    item, ok = QInputDialog.getItem(self, "Select SeisWare Project",
                                    "List of SeisWare Projects", projects, 0,
                                    False)

    if ok and item:
        self.model.add(item)
Exemplo n.º 16
0
    def edit_target_class(self, target_idx=-1):
        # findout which target is selected first
        if target_idx < 0:
            target_idx = self.targetList.currentRow()
        
        # if yaml is provided (ex: in task)
        if len(self.cls_map) > 0:
            class_list = []
            for cls_idx, cls_name in self.cls_map.items():
                class_list.append(f"{cls_idx}-{cls_name}")
            # show a dialog
            dialog = QInputDialog()
            label_text = "Input the correct class number.\n"\
                "Please note your input will not be checked for legality"
            item, okPressed = \
                QInputDialog.getItem(dialog, \
                "Edit class", \
                label_text, \
                class_list, False)
            # print(text, okPressed)
            if okPressed and item:
                cur_bbox = label_table[self.data_name][target_idx]
                old_bbox = BBox(cur_bbox.xywh, cur_bbox.imgSizeWH, cur_bbox.cls)
                class_idx = item.split('-')[0] 
                label_table[self.data_name][target_idx].cls = int(class_idx)
                self.last_cls = int(class_idx)
                # log the change
                new_data = label_table[self.data_name][target_idx].to_label_str()
                # print(new_data)
                mod = [self.data_name, target_idx, new_data, old_bbox]
                modification_list.append(mod)
                self.ui_form.check_undoable()
                self.show()
        else:
            dialog = QInputDialog()
            label_text = "Input the correct class number.\n"\
                "Please note your input will not be checked for legality"
            text, okPressed = \
                QInputDialog.getText(dialog, \
                "Edit class", \
                label_text, \
                QLineEdit.Normal)

            if okPressed and text != '':
                cur_bbox = label_table[self.data_name][target_idx]
                old_bbox = BBox(cur_bbox.xywh, cur_bbox.imgSizeWH, cur_bbox.cls)
                label_table[self.data_name][target_idx].cls = int(text)
                self.last_cls = int(text)
                # log the change
                new_data = label_table[self.data_name][target_idx].to_label_str()
                # print(new_data)
                mod = [self.data_name, target_idx, new_data, old_bbox]
                modification_list.append(mod)
                self.ui_form.check_undoable()
                self.show()
Exemplo n.º 17
0
    def getItem(self, prompt="Enter an option: "):
        items = ('Candlestick', 'Closing Prices')

        item, ok = QInputDialog.getItem(self, prompt, 'Choose a chart type:',
                                        items, 0, False)

        if ok and item:
            self.le.setText(item)
            return str(item)
        else:
            return None
Exemplo n.º 18
0
 def form_bookkeeping_msg_tappio(self, event_n):
     while True:
         item, ok = QInputDialog.getItem(self, "Choose account number", "Please input internal account for bank entry with message: {0}, " \
               "recipient/payer: {1} with amount {2}:\n".format(self._msg, self._from_to, str(int(self._amount)/100)), self._accounts, 0, False)
         #internal_account = input("Please input internal account for bank entry with message: {0}, " \
         #      "recipient/payer: {1} with amount {2}:\n".format(self._msg, self._from_to, str(int(self._amount)/100)))
         print('\n')
         if ok:
             internal_account = item.split(" ")[0]
             return BOOKKEEPING_BOOK_ENTRY_FORMAT.format(
                 event_n, self._date.strftime('%Y %m %d'), self._msg,
                 "10003", self._amount, internal_account, self._amount * -1)
Exemplo n.º 19
0
    def select_theme_action(self):
        path = resource_path("assets/themes")
        theme_files = [f for f in listdir(path) if isfile(join(path, f))]

        theme, ok = QInputDialog.getItem(self, "Experimental: Select Theme",
                                         "Choose theme to use from the list",
                                         theme_files, 0, False)
        if not ok:
            return

        with open(resource_path(f"assets/themes/{theme}"), "r") as fh:
            self.setStyleSheet(fh.read())
Exemplo n.º 20
0
 def _maybe_select_road(self):
     roads = self._person.inside_of_roads
     if not roads:
         speech().speak(_("You are not on a road."), interrupt=True, add_to_history=False)
         return None
     if len(roads) == 1:
         return roads[0]
     else:
         road_reprs = [describe_entity(r) for r in roads]
         road_repr, ok = QInputDialog.getItem(self._main_window, _("Request"), _("Select the road which should be the target of the operation"), road_reprs, editable=False)
         if not ok:
             return None
         return roads[road_reprs.index(road_repr)]
Exemplo n.º 21
0
 def go_to_bookmark(self, evt):
     bookmarks = self._person.map.bookmarks
     reprs = []
     for mark in bookmarks:
         point = LatLon(mark.latitude, mark.longitude)
         dist = format_number(distance_between(self._person.position, point), config().presentation.distance_decimal_places)
         bearing = format_number((bearing_to(self._person.position, point) - self._person.direction) % 360, config().presentation.angle_decimal_places)
         reprs.append(_("{name}: distance {distance} meters, {bearing}° relatively").format(name=mark.name, distance=dist, bearing=bearing))
     name, ok = QInputDialog.getItem(self._main_window, _("Data entry"), _("Select a bookmark"), reprs, editable=False)
     if not ok:
         return
     bookmark = bookmarks[reprs.index(name)]
     self._person.move_to(LatLon(bookmark.latitude, bookmark.longitude), force=True)
     self._person.set_direction(bookmark.direction)
Exemplo n.º 22
0
    def _on_copy_to_pressed(self):
        logging.info("Beginning copy to for " + self.module.name)

        choices = []
        for i in range(0, len(self.module.entries)):
            choices.append(str(i + 1) + ". " + self.model.data(self.model.index(i, 0), QtCore.Qt.DisplayRole))
        choice = QInputDialog.getItem(self, "Select Destination", "Destination", choices)

        if choice[1]:
            for i in range(0, len(choices)):
                if choice[0] == choices[i]:
                    self._copy_properties(self.selection, self.module.entries[i])
        else:
            logging.info("No choice selected for " + self.module.name + " copy to. Aborting.")
Exemplo n.º 23
0
    def _on_copy_to_triggered(self):
        if not self.selection:
            return

        logging.info("Beginning copy to for " + self.module.name)
        choices = []
        for i in range(0, len(self.module.entries)):
            choices.append(str(i + 1) + ". " + self.module.entries[i].get_display_name())
        choice = QInputDialog.getItem(self, "Select Destination", "Destination", choices)
        if choice[1]:
            for i in range(0, len(choices)):
                if choice[0] == choices[i]:
                    self.selection.copy_to(self.module.entries[i])
        else:
            logging.info("No choice selected for " + self.module.name + " copy to. Aborting.")
Exemplo n.º 24
0
    def new_item(self, frame: QMainWindow, data_icons: Dict[str, QIcon],
                 css_buf: Optional[str]) -> Optional[GlobalItemID]:
        contact_model = self._contact_model
        type_map = OrderedDict((x.type_name.lower(), x) for x in contact_model.iter_object_classes())
        type_name, ok = QInputDialog.getItem(frame, 'new', 'select a type', list(type_map.keys()), editable=False)
        if ok:
            contact_cls = type_map[type_name]
            new_contact = self._contact_model.create_contact(contact_cls.contact_type)

            dlg = ContactEditDialog(frame, new_contact, contact_model, data_icons=data_icons)
            if dlg.exec() == dlg.Accepted:
                contact_model.add_changes(
                    date_changes=dlg.date_changes,
                    fact_changes=dlg.fact_changes
                )
                return _convert_contact2global_id(new_contact.id)
Exemplo n.º 25
0
    def edit_tag(self, mode):
        tags = [btn.text() for btn in self.ui.tag_btn_group.buttons()[2:]]
        if mode == "Remove":
            tags.append("[All tags]")
        else:
            tags.append("")
        selected_tag_name, ok = QInputDialog.getItem(self.ui, mode + " tag",
                                                     "Select tag:", tags, 0,
                                                     False)
        if ok and selected_tag_name:
            if mode == "Remove":
                if selected_tag_name != "[All tags]":
                    self.ui.tag_btn_group.buttons()[
                        tags.index(selected_tag_name) + 2].deleteLater()
                    self.tag_dir_dict.pop(selected_tag_name)
                    self.configurator.using_conf_dict['tags set'].pop(
                        self.configurator.using_conf_dict['tags set'].index(
                            selected_tag_name))
                else:
                    [
                        tag_btn.deleteLater()
                        for tag_btn in self.ui.tag_btn_group.buttons()[2:]
                    ]
                    self.configurator.using_conf_dict['tags set'].clear()
            else:
                tag_name, ok = QInputDialog.getText(self.ui, "Rename tag",
                                                    "New tag name:",
                                                    QLineEdit.Normal,
                                                    selected_tag_name)
                if ok and tag_name:
                    self.configurator.using_conf_dict['tags set'].pop(
                        self.configurator.using_conf_dict['tags set'].index(
                            selected_tag_name))
                    self.ui.tag_btn_group.buttons()[
                        tags.index(selected_tag_name) + 2].setText(tag_name)
                    self.tag_dir_dict[
                        tag_name] = self.configurator.using_conf_dict[
                            'root for tagging results'] + "/" + tag_name

                    self.configurator.using_conf_dict['tags set'].append(
                        tag_name)
                    if not os.path.exists(self.tag_dir_dict[tag_name]):
                        os.makedirs(self.tag_dir_dict[tag_name])
Exemplo n.º 26
0
 def newFunc(self):
     """
     Creates a new table, it opens a popup for the user to 
     chose the type and name
     """
     items = ["Members", "Finances"]
     tableType = QInputDialog.getItem(self, "New table", "table type",
                                      items, 0, False)
     if tableType[1]:
         tableName = QInputDialog.getText(self, "New table", "table name")
         if tableName[1]:
             if tableType == "Members":
                 table = Group(tableName[1])
             else:
                 table = Table(tableName[0])
             dataTable = DataTable(name=tableName[0],
                                   table=table,
                                   tableType=tableType[0])
             self.mainWindow_.contentTab.addTable(dataTable)
Exemplo n.º 27
0
def get_query_from_user(parent, position):
    entities = all_known_discriminators()
    name_mapping = {}
    for entity in entities:
        name_mapping[get_class_display_name(entity)] = entity
    entity, ok = QInputDialog.getItem(parent,
                                      _("Search class"),
                                      _("Select the class to search"),
                                      sorted(name_mapping.keys()),
                                      editable=False)
    if not ok:
        return
    discriminator = name_mapping[entity]
    conditions_dialog = SpecifySearchConditionsDialog(parent,
                                                      entity=discriminator)
    if conditions_dialog.exec_() != SpecifySearchConditionsDialog.Accepted:
        return
    distance = conditions_dialog.distance or float("inf")
    query = create_query(discriminator, position, distance,
                         conditions_dialog.create_conditions())
    return query, distance
Exemplo n.º 28
0
    def _select_database(self):
        """
        Lets user select a database from available databases.

        Shows a dialog from which user can select a single database.
        If there is only a single database it is selected automatically and no dialog is shown.

        Returns:
             the database map of the database or None if no database was selected
        """
        if len(self.db_maps) == 1:
            return next(iter(self.db_maps))
        db_names = [x.codename for x in self.db_maps]
        selected_database, ok = QInputDialog.getItem(
            self,
            "Select database",
            "Select database to export",
            db_names,
            editable=False)
        if not ok:
            return None
        return self.db_maps[db_names.index(selected_database)]
Exemplo n.º 29
0
 def inv_add_copy(self, new_loc=None, new_size=None):
     # Adds a copy of the selected bottle by asking for a new size and location
     bottle_sizes = [
         self.AddBottleBottleSize.itemText(i)
         for i in range(self.AddBottleBottleSize.count())
     ]
     if not new_size:
         new_size, ok_pressed = QInputDialog.getItem(
             self, 'New Size', 'Select New Bottle Size:', bottle_sizes, 2,
             False)
         if ok_pressed == True:
             pass
         if new_size == 'Other...':
             new_size = self.get_other_size()
     self.bottle.bottle_info['bottle_size'] = new_size
     if not new_loc:
         new_loc, ok_pressed = QInputDialog.getText(self, 'New Location',
                                                    'Enter new location:',
                                                    QLineEdit.Normal, '')
         if ok_pressed == True:
             pass
     self.bottle.bottle_info['location'] = new_loc
     self.bottle.add_new()
     self.quick_search()
Exemplo n.º 30
0
    def actionCalled(self):
        """
        Dodaje child node
        """
        parent = QApplication.instance().selectionModel
        if isinstance(parent, Book):
            newName, ok = QInputDialog.getText(None, "New Chapter name",
                                               "Enter desired new name")
            if ok:
                if parent.isValidName(newName):
                    parent.addChild(Chapter(newName))

                else:
                    while not parent.isValidName(newName):
                        dialog = QMessageBox()
                        dialog.setWindowTitle("Error")
                        dialog.setText("That name is not valid")
                        dialog.setWindowIcon(QIcon("src/notification.png"))
                        dialog.setModal(True)
                        dialog.exec_()
                        newName, cancel = QInputDialog.getText(
                            None, "New Chapter name", "Enter desired new name")
                        if not cancel:
                            break
                        else:
                            if parent.isValidName(newName):
                                parent.addChild(Chapter(newName))
                                break
        if isinstance(parent, Chapter):
            if len(parent.getChildren()) > 0:
                parent.addChild(
                    Page(parent.getChildren()[-1].getName()[:-1] +
                         str(int(parent.getChildren()[-1].getName()[-1:]) +
                             1)))
            else:
                parent.addChild(Page("Strana1"))
        if isinstance(parent, Page):
            item, ok = QInputDialog.getItem(QInputDialog(), "Add an element",
                                            "Choose one option:",
                                            ["Add text", "Add picture"], 0,
                                            False)
            if ok:
                if item == "Add text":
                    tmpList = []
                    for child in parent.getChildren():
                        if isinstance(child, Text):
                            tmpList.append(child)
                    if len(tmpList) > 0:
                        parent.addChild(
                            Text(tmpList[-1].getName()[:-1] +
                                 str(int(tmpList[-1].getName()[-1:]) + 1)))
                    else:
                        parent.addChild(Text("Text1"))
                if item == "Add picture":
                    image = QFileDialog.getOpenFileName(None, 'OpenFile', '')
                    if image[1]:
                        path = image[0]
                        if path != None:
                            tmpPic = Picture(path.split("/")[-1])
                            tmpPic.setPicture(path)
                            parent.addChild(tmpPic)