def getWideget(self):

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.searchShip)

        maxAgelabel = QtGui.QLabel("Max Age:")
        self.maxAgeSpinBox = QtGui.QSpinBox()
        self.maxAgeSpinBox.setRange(1, 1000)
        self.maxAgeSpinBox.setSuffix("Day")
        self.maxAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxAgeSpinBox.setValue(1)

        ShipLabel = QtGui.QLabel("Ship:")
        self.shipComboBox = QtGui.QComboBox()

        ships = self.mydb.getAllShipnames()
        self.shipList = []
        for ship in ships:
            self.shipComboBox.addItem(ship["Name"])
            self.shipList.append(ship["id"])
        self.shipComboBox.currentIndexChanged.connect(self.searchShip)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.searchShip)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)

        layout.addWidget(maxAgelabel)
        layout.addWidget(self.maxAgeSpinBox)

        layout.addWidget(ShipLabel)
        layout.addWidget(self.shipComboBox)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        # locationGroupBox.setFlat(True)
        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        #        self.proxyModel = QtGui.QSortFilterProxyModel()
        #        self.proxyModel.setDynamicSortFilter(True)

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        #        self.listView.setModel(self.proxyModel)
        self.listView.setSortingEnabled(True)

        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)

        return vGroupBox
Esempio n. 2
0
    def getWideget(self):

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.showBookmarks)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.showBookmarks)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        # locationGroupBox.setFlat(True)
        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        self.listView.setAlternatingRowColors(True)
        self.listView.setSortingEnabled(False)
        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)
        self.listView.setRootIsDecorated(True)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)

        self.showBookmarks()

        return vGroupBox
Esempio n. 3
0
    def getWideget(self):

        gridLayout = QtGui.QGridLayout()

        gridLayout.setColumnStretch(1, 1)
        gridLayout.setColumnStretch(3, 2)
        gridLayout.setColumnStretch(4, 1)
        gridLayout.setColumnStretch(6, 2)
        gridLayout.setColumnStretch(7, 1)
        gridLayout.setColumnStretch(9, 2)

        self.forceMaxHops = QtGui.QCheckBox("Force Max Hops")
        if self.mydb.getConfig("option_mhr_forceMaxHops"):
            self.forceMaxHops.setChecked(True)
        self.forceMaxHops.setToolTip("Show only routes with Max Hops+Back Hop")
        gridLayout.addWidget(self.forceMaxHops, 1, 0)

        self.onlyLpadsize = QtGui.QCheckBox("Only L Pads")
        if self.mydb.getConfig("option_mhr_onlyLpadsize"):
            self.onlyLpadsize.setChecked(True)
        self.onlyLpadsize.setToolTip(
            "Find only stations with a large landingpad")
        gridLayout.addWidget(self.onlyLpadsize, 2, 0)

        self.autoUpdateLocation = QtGui.QCheckBox("Location Update")
        self.autoUpdateLocation.setChecked(True)
        self.autoUpdateLocation.stateChanged.connect(self.updateLocation)
        gridLayout.addWidget(self.autoUpdateLocation, 3, 0)

        label = QtGui.QLabel("Max Hops:")
        self.maxHopsspinBox = QtGui.QSpinBox()
        self.maxHopsspinBox.setRange(1, 20)
        self.maxHopsspinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxHopsspinBox.setValue(self.route.getOption("tradingHops"))
        gridLayout.addWidget(label, 1, 2)
        gridLayout.addWidget(self.maxHopsspinBox, 1, 3)

        label = QtGui.QLabel("Search Range:")
        self.searchRangeSpinBox = QtGui.QSpinBox()
        self.searchRangeSpinBox.setRange(0, 1000)
        self.searchRangeSpinBox.setSuffix("ly")
        self.searchRangeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.searchRangeSpinBox.setValue(
            self.route.getOption("maxSearchRange"))
        gridLayout.addWidget(label, 1, 5)
        gridLayout.addWidget(self.searchRangeSpinBox, 1, 6)

        label = QtGui.QLabel("Max Data Age:")
        self.maxAgeSpinBox = QtGui.QSpinBox()
        self.maxAgeSpinBox.setRange(1, 1000)
        self.maxAgeSpinBox.setSuffix("Day")
        self.maxAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxAgeSpinBox.setValue(self.route.getOption("maxAge"))
        gridLayout.addWidget(label, 1, 8)
        gridLayout.addWidget(self.maxAgeSpinBox, 1, 9)

        label = QtGui.QLabel("Min Profit:")
        self.minProfitSpinBox = QtGui.QSpinBox()
        self.minProfitSpinBox.setRange(1000, 10000)
        self.minProfitSpinBox.setSuffix("cr")
        self.minProfitSpinBox.setSingleStep(100)
        self.minProfitSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.minProfitSpinBox.setValue(self.route.getOption("minTradeProfit"))
        gridLayout.addWidget(label, 2, 2)
        gridLayout.addWidget(self.minProfitSpinBox, 2, 3)

        label = QtGui.QLabel("Max Dist:")
        self.maxDistSpinBox = QtGui.QSpinBox()
        self.maxDistSpinBox.setRange(0, 1000)
        self.maxDistSpinBox.setSuffix("ly")
        self.maxDistSpinBox.setSingleStep(1)
        self.maxDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxDistSpinBox.setValue(self.route.getOption("maxDist"))
        gridLayout.addWidget(label, 2, 5)
        gridLayout.addWidget(self.maxDistSpinBox, 2, 6)

        label = QtGui.QLabel("Max Star Dist:")
        self.maxStartDistSpinBox = QtGui.QSpinBox()
        self.maxStartDistSpinBox.setRange(10, 7000000)
        self.maxStartDistSpinBox.setSuffix("ls")
        self.maxStartDistSpinBox.setSingleStep(100)
        self.maxStartDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxStartDistSpinBox.setValue(self.route.getOption("maxStarDist"))
        gridLayout.addWidget(label, 2, 8)
        gridLayout.addWidget(self.maxStartDistSpinBox, 2, 9)

        label = QtGui.QLabel("Search Accuracy:")
        self.searchLimitOption = QtGui.QComboBox()
        searchLimitOptionsList = ["normal", "fast", "nice", "slow", "all"]
        for option in searchLimitOptionsList:
            self.searchLimitOption.addItem(option)
        if self.mydb.getConfig("option_searchLimit"):
            self.searchLimitOption.setCurrentIndex(
                self.mydb.getConfig("option_searchLimit"))
        label.setBuddy(self.searchLimitOption)
        # self.searchLimitOption.currentIndexChanged.connect(self.hmm)
        gridLayout.addWidget(label, 3, 2)
        gridLayout.addWidget(self.searchLimitOption, 3, 3, 1,
                             1)  # row,col,?,size

        label = QtGui.QLabel("Max Jump Dist:")
        self.maxJumpDistSpinBox = QtGui.QDoubleSpinBox()
        self.maxJumpDistSpinBox.setRange(0, 1000)
        self.maxJumpDistSpinBox.setSuffix("ly")
        self.maxJumpDistSpinBox.setSingleStep(1)
        self.maxJumpDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.maxJumpDistSpinBox.setValue(
            self.route.getOption("maxJumpDistance"))
        gridLayout.addWidget(label, 3, 5)
        gridLayout.addWidget(self.maxJumpDistSpinBox, 3, 6)

        label = QtGui.QLabel("Min Stock:")
        self.minStockSpinBox = QtGui.QSpinBox()
        self.minStockSpinBox.setRange(1000, 1000000)
        self.minStockSpinBox.setSingleStep(100)
        self.minStockSpinBox.setAlignment(QtCore.Qt.AlignRight)
        self.minStockSpinBox.setValue(self.route.getOption("minStock"))
        gridLayout.addWidget(label, 3, 8)
        gridLayout.addWidget(self.minStockSpinBox, 3, 9)

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.triggerLocationChanged)

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        self.showOptions = QtGui.QCheckBox("Show Options")
        if self.mydb.getConfig("option_mhr_showOptions") != 0:
            self.showOptions.setChecked(True)
        self.showOptions.stateChanged.connect(
            self.optionsGroupBoxToggleViewAction)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.startRouteSearch)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)
        layout.addWidget(self.locationlineEdit)
        layout.addWidget(self.showOptions)
        layout.addWidget(self.searchbutton)

        locationGroupBox.setLayout(layout)

        self.optionsGroupBox = QtGui.QGroupBox("Options")
        self.optionsGroupBox.setLayout(gridLayout)

        self.listView = QtGui.QTreeView()
        self.listView.setAlternatingRowColors(True)
        self.listView.setSortingEnabled(True)
        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.routelistContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(self.optionsGroupBox)
        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)
        self.optionsGroupBoxToggleViewAction()

        return vGroupBox
Esempio n. 4
0
    def getWideget(self):

        gridLayout = QtGui.QGridLayout()

        gridLayout.setColumnStretch(1, 1)
        gridLayout.setColumnStretch(3, 2)
        gridLayout.setColumnStretch(4, 1)
        gridLayout.setColumnStretch(6, 2)

        self.autoUpdateLocation = QtGui.QCheckBox("Auto Switch/Location")
        self.autoUpdateLocation.setChecked(False)
        self.autoUpdateLocation.stateChanged.connect(self.updateLocation)
        gridLayout.addWidget(self.autoUpdateLocation, 1, 0)

        label = QtGui.QLabel("Min Profit:")
        self.minProfitSpinBox = QtGui.QSpinBox()
        self.minProfitSpinBox.setRange(0, 10000)
        self.minProfitSpinBox.setSuffix("cr")
        self.minProfitSpinBox.setSingleStep(100)
        self.minProfitSpinBox.setAlignment(QtCore.Qt.AlignRight)
        minTradeProfit = self.mydb.getConfig('option_dft_minProfit')
        if minTradeProfit:
            self.minProfitSpinBox.setValue(minTradeProfit)
        gridLayout.addWidget(label, 1, 2)
        gridLayout.addWidget(self.minProfitSpinBox, 1, 3)

        label = QtGui.QLabel("Max Data Age:")
        self.maxAgeSpinBox = QtGui.QSpinBox()
        self.maxAgeSpinBox.setRange(1, 1000)
        self.maxAgeSpinBox.setSuffix("Day")
        self.maxAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        configval = self.mydb.getConfig('option_dft_maxAgeDate')
        if configval:
            self.maxAgeSpinBox.setValue(configval)
        else:
            self.maxAgeSpinBox.setValue(14)
        gridLayout.addWidget(label, 1, 5)
        gridLayout.addWidget(self.maxAgeSpinBox, 1, 6)

        label = QtGui.QLabel("Min Stock:")
        self.minStockSpinBox = QtGui.QSpinBox()
        self.minStockSpinBox.setRange(0, 1000000)
        self.minStockSpinBox.setSingleStep(100)
        self.minStockSpinBox.setAlignment(QtCore.Qt.AlignRight)
        configval = self.mydb.getConfig('option_dft_minStock')
        if configval:
            self.minStockSpinBox.setValue(configval)
        else:
            self.minStockSpinBox.setValue(100)
        gridLayout.addWidget(label, 2, 2)
        gridLayout.addWidget(self.minStockSpinBox, 2, 3)

        label = QtGui.QLabel("Max Star Dist:")
        self.maxStartDistSpinBox = QtGui.QSpinBox()
        self.maxStartDistSpinBox.setRange(10, 7000000)
        self.maxStartDistSpinBox.setSuffix("ls")
        self.maxStartDistSpinBox.setSingleStep(10)
        self.maxStartDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        maxStarDist = self.mydb.getConfig('option_maxStarDist')
        if maxStarDist:
            self.maxStartDistSpinBox.setValue(maxStarDist)
        gridLayout.addWidget(label, 2, 5)
        gridLayout.addWidget(self.maxStartDistSpinBox, 2, 6)

        fromsystemlabel = QtGui.QLabel("From System:")
        self.fromSystem = guitools.LineEdit()
        configval = self.mydb.getConfig('option_dft_fromSystem')
        if configval:
            self.fromSystem.setText(configval)

        self.fromSystem.textChanged.connect(self.triggerFromSystemChanged)

        fromstationlabel = QtGui.QLabel("Station:")
        self.fromStation = guitools.LineEdit()

        configval = self.mydb.getConfig('option_dft_fromStation')
        if configval:
            self.fromStation.setText(configval)
        self.fromStation.textChanged.connect(self.triggerFromStationChanged)

        tosystemlabel = QtGui.QLabel("To System:")
        self.toSystem = guitools.LineEdit()
        configval = self.mydb.getConfig('option_dft_toSystem')
        if configval:
            self.toSystem.setText(configval)

        self.toSystem.textChanged.connect(self.triggerToSystemChanged)

        tostationlabel = QtGui.QLabel("Station:")
        self.toStation = guitools.LineEdit()
        configval = self.mydb.getConfig('option_dft_toStation')
        if configval:
            self.toStation.setText(configval)
        self.toStation.textChanged.connect(self.triggerToStationChanged)

        self.showOptions = QtGui.QCheckBox("Show Options")
        if self.mydb.getConfig("option_dft_showOptions") != 0:
            self.showOptions.setChecked(True)
        self.showOptions.stateChanged.connect(
            self.optionsGroupBoxToggleViewAction)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.searchDeals)

        self.locationButton = QtGui.QToolButton()
        self.locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        self.locationButton.clicked.connect(self.setCurentLocation)
        self.locationButton.setToolTip("Current Location")

        self.switchButton = QtGui.QToolButton()
        self.switchButton.setIcon(
            self.guitools.getIconFromsvg("img/switchTopBottom.svg"))
        self.switchButton.clicked.connect(self.switchLocations)
        self.switchButton.setToolTip("Switch Location")

        searchgridLayout = QtGui.QGridLayout()
        searchgridLayout.setContentsMargins(2, 2, 2, 2)

        searchgridLayout.addWidget(self.locationButton, 0, 0)

        searchgridLayout.addWidget(fromsystemlabel, 0, 1)
        searchgridLayout.addWidget(self.fromSystem, 0, 2)

        searchgridLayout.addWidget(fromstationlabel, 0, 4)
        searchgridLayout.addWidget(self.fromStation, 0, 5)

        searchgridLayout.addWidget(self.showOptions, 0, 7)

        searchgridLayout.addWidget(self.switchButton, 1, 0)

        searchgridLayout.addWidget(tosystemlabel, 1, 1)
        searchgridLayout.addWidget(self.toSystem, 1, 2)

        searchgridLayout.addWidget(tostationlabel, 1, 4)
        searchgridLayout.addWidget(self.toStation, 1, 5)

        searchgridLayout.addWidget(self.searchbutton, 1, 7)

        self.optionsGroupBox = QtGui.QGroupBox("Options")
        self.optionsGroupBox.setLayout(gridLayout)

        self.searchGroupBox = QtGui.QGroupBox()
        self.searchGroupBox.setFlat(True)
        self.searchGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;} QGridLayout {border:0;margin:0;padding:0;} margin:0;padding:0;"""
        )

        self.searchGroupBox.setLayout(searchgridLayout)

        self.listView = QtGui.QTreeView()

        self.proxyModel = QtGui.QSortFilterProxyModel()
        self.proxyModel.setDynamicSortFilter(True)

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        self.listView.setModel(self.proxyModel)
        self.listView.setSortingEnabled(True)
        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.dealslistContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)
        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(self.optionsGroupBox)
        layout.addWidget(self.searchGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.triggerFromSystemChanged()
        self.triggerFromStationChanged()
        self.triggerToSystemChanged()
        self.triggerToStationChanged()

        self.optionsGroupBoxToggleViewAction()

        return vGroupBox
    def getWideget(self):

        gridLayout = QtGui.QGridLayout()
        gridLayout.setContentsMargins(6, 6, 6, 6)

        gridLayout.setColumnStretch(9, 1)

        self.priceWarning = QtGui.QCheckBox("Price Warning")
        option = self.mydb.getConfig("option_ds_priceWarning")
        if option is False or option == 1:
            self.priceWarning.setChecked(True)
        self.priceWarning.setToolTip(
            "Show price warnings, old or not existing data")
        gridLayout.addWidget(self.priceWarning, 1, 1)

        self.outfittingWarning = QtGui.QCheckBox("Outfitting Warning")
        option = self.mydb.getConfig("option_ds_outfittingWarning")
        if option is False or option == 1:
            self.outfittingWarning.setChecked(True)
        self.outfittingWarning.setToolTip(
            "Show outfitting warnings, old or not existing data")
        gridLayout.addWidget(self.outfittingWarning, 1, 2)

        self.shipyardWarning = QtGui.QCheckBox("Shipyard Warning")
        option = self.mydb.getConfig("option_ds_shipyardWarning")
        if option is False or option == 1:
            self.shipyardWarning.setChecked(True)
        self.shipyardWarning.setToolTip(
            "Show shipyard warnings, old or not existing data")
        gridLayout.addWidget(self.shipyardWarning, 1, 3)

        self.noStationWarning = QtGui.QCheckBox("No Station Warning")
        option = self.mydb.getConfig("option_ds_noStationWarning")
        if option is False or option == 1:
            self.noStationWarning.setChecked(True)
        self.noStationWarning.setToolTip(
            "Show no station warnings, No station in system")
        gridLayout.addWidget(self.noStationWarning, 1, 4)

        label = QtGui.QLabel("Search Range:")
        self.searchRangeSpinBox = QtGui.QSpinBox()
        self.searchRangeSpinBox.setRange(0, 1000)
        self.searchRangeSpinBox.setSuffix("ly")
        self.searchRangeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_ds_maxSearchRange"):
            self.searchRangeSpinBox.setValue(
                self.mydb.getConfig("option_ds_maxSearchRange"))
        else:
            self.searchRangeSpinBox.setValue(10)

        gridLayout.addWidget(label, 1, 10)
        gridLayout.addWidget(self.searchRangeSpinBox, 1, 11)

        label = QtGui.QLabel("Info > Age:")
        self.infoAgeSpinBox = QtGui.QSpinBox()
        self.infoAgeSpinBox.setRange(1, 1000)
        self.infoAgeSpinBox.setSuffix("h")
        self.infoAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_ds_infoAge"):
            self.infoAgeSpinBox.setValue(
                self.mydb.getConfig("option_ds_infoAge"))
        else:
            self.infoAgeSpinBox.setValue(12)
        gridLayout.addWidget(label, 1, 13)
        gridLayout.addWidget(self.infoAgeSpinBox, 1, 14)

        self.optionsGroupBox = QtGui.QGroupBox("Options")
        self.optionsGroupBox.setLayout(gridLayout)

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.showStatus)

        self.showOptions = QtGui.QCheckBox("Show Options")
        option = self.mydb.getConfig("option_ds_showOptions")
        if option is False or option == 1:
            self.showOptions.setChecked(True)
        self.showOptions.stateChanged.connect(
            self.optionsGroupBoxToggleViewAction)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.showStatus)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)
        layout.addWidget(self.showOptions)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        #        self.listView.setModel(self.proxyModel)
        self.listView.setSortingEnabled(True)

        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(self.optionsGroupBox)
        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)

        self.optionsGroupBoxToggleViewAction()

        return vGroupBox
    def openWindow(self):


        self.setWindowTitle("Add or Edit Items")
        self.setMinimumSize(700, 300)


        locationButton = QtGui.QToolButton()
        locationButton.setIcon(self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")


        systemlabel = QtGui.QLabel("System:")
        self.systemLineEdit = guitools.LineEdit()
        self.systemLineEdit.textChanged.connect(self.triggerSystemChanged)


        stationlabel = QtGui.QLabel("Station:")
        self.stationLineEdit = guitools.LineEdit()
        self.stationLineEdit.textChanged.connect(self.triggerStationChanged)


        locationLayout = QtGui.QHBoxLayout()
        locationLayout.setContentsMargins(6, 12, 6, 6)

        locationLayout.addWidget(systemlabel)
        locationLayout.addWidget(locationButton)
        locationLayout.addWidget(self.systemLineEdit)
        locationLayout.addWidget(stationlabel)
        locationLayout.addWidget(self.stationLineEdit)


        locationGroup = QtGui.QGroupBox("Location")
        locationGroup.setContentsMargins(6, 6, 6, 6)

        locationGroup.setLayout(locationLayout)



        addItemlabel = QtGui.QLabel("Add Item:")
        addItemButton = QtGui.QToolButton()
        addItemButton.setIcon(self.guitools.getIconFromsvg("img/addItem.svg"))
        addItemButton.clicked.connect(self.addItem)


        addItemLayout = QtGui.QHBoxLayout()
        addItemLayout.setContentsMargins(0, 0, 0, 0)

        addItemLayout.addWidget(addItemlabel)
        addItemLayout.addWidget(addItemButton)
        addItemLayout.addStretch(1)


        addItemGroup = QtGui.QGroupBox()
        addItemGroup.setFlat(True)
        addItemGroup.setContentsMargins(0, 0, 0, 0)
        addItemGroup.setStyleSheet("""QGroupBox {border:0;margin:0;padding:0;}""")

        addItemGroup.setLayout(addItemLayout)


        self.tableWidget = QtGui.QTableWidget(0, len(self.headerList))
        self.tableWidget.setHorizontalHeaderLabels(self.headerList)
        self.tableWidget.horizontalHeader().setResizeMode( self.headerList.index("Item"), QtGui.QHeaderView.Stretch)
        self.tableWidget.horizontalHeader().setResizeMode( self.headerList.index("Blackmarket"), QtGui.QHeaderView.ResizeToContents)
        self.tableWidget.horizontalHeader().setResizeMode( self.headerList.index("Ignore"), QtGui.QHeaderView.ResizeToContents)
        self.tableWidget.horizontalHeader().setResizeMode( self.headerList.index("Fake"), QtGui.QHeaderView.ResizeToContents)

        self.tableWidget.setShowGrid(True)


        closeButton = QtGui.QPushButton("Close")
        closeButton.clicked.connect(self.close)
        saveButton = QtGui.QPushButton("Save")
        saveButton.clicked.connect(self.saveItems)

        buttonsLayout = QtGui.QHBoxLayout()
        buttonsLayout.addStretch(1)
        buttonsLayout.addWidget(saveButton)
        buttonsLayout.addWidget(closeButton)


        self.mainLayout = QtGui.QVBoxLayout()
        self.mainLayout.addWidget(locationGroup)
        self.mainLayout.addWidget(addItemGroup)
        
        self.mainLayout.addWidget(self.tableWidget)
        self.mainLayout.addSpacing(12)

        self.mainLayout.addLayout(buttonsLayout)


        self.setLayout(self.mainLayout)

        self.triggerSystemChanged()
        self.triggerStationChanged()
       

        self.setCurentLocation()

        self.show()
Esempio n. 7
0
    def getWideget(self):

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        configval = self.mydb.getConfig('option_pcf_location')
        if configval:
            self.locationlineEdit.setText(configval)
        else:
            self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.searchPower)

        self.controlCheckBox = QtGui.QCheckBox("Show Controlled")
        self.controlCheckBox.setChecked(True)
        self.controlCheckBox.stateChanged.connect(self.searchPower)

        self.exploitedCheckBox = QtGui.QCheckBox("Show Exploited")
        self.exploitedCheckBox.setChecked(False)
        self.exploitedCheckBox.stateChanged.connect(self.searchPower)

        self.expansionCheckBox = QtGui.QCheckBox("Show Expansion")
        self.expansionCheckBox.setChecked(False)
        self.expansionCheckBox.stateChanged.connect(self.searchPower)

        powerLabel = QtGui.QLabel("Power:")
        self.powerComboBox = QtGui.QComboBox()

        powers = self.mydb.getAllPowers()
        self.powerList = []
        for power in powers:
            self.powerComboBox.addItem(power["Name"])
            self.powerList.append(power["id"])

        if self.mydb.getConfig("option_pcf_power"):
            self.powerComboBox.setCurrentIndex(
                self.mydb.getConfig("option_pcf_power"))

        self.powerComboBox.currentIndexChanged.connect(self.searchPower)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.searchPower)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)

        layout.addWidget(self.controlCheckBox)
        layout.addWidget(self.exploitedCheckBox)
        layout.addWidget(self.expansionCheckBox)

        layout.addWidget(powerLabel)
        layout.addWidget(self.powerComboBox)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )
        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        self.listView.setSortingEnabled(True)

        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)
        self.searchPower()

        return vGroupBox
    def getWideget(self):

        gridLayout = QtGui.QGridLayout()
        gridLayout.setContentsMargins(6, 6, 6, 6)

        gridLayout.setColumnStretch(3, 1)
        gridLayout.setColumnStretch(6, 1)
        gridLayout.setColumnStretch(9, 1)

        label = QtGui.QLabel("Class:")
        self.classComboBox = QtGui.QComboBox()

        self.classComboBox.addItem("Any")
        for myClass in range(0, 9):
            self.classComboBox.addItem(str(myClass))
        self.classComboBox.currentIndexChanged.connect(self.searchOutfitting)
        gridLayout.addWidget(label, 1, 1)
        gridLayout.addWidget(self.classComboBox, 1, 2)

        label = QtGui.QLabel("Mount:")
        self.mountComboBox = QtGui.QComboBox()
        self.mountComboBox.addItem("Any")
        self.mountList = [None]

        for mount in self.outfitting.getMountList():
            self.mountComboBox.addItem(mount['mount'])
            self.mountList.append(mount['id'])
        self.mountComboBox.currentIndexChanged.connect(self.searchOutfitting)
        gridLayout.addWidget(label, 1, 4)
        gridLayout.addWidget(self.mountComboBox, 1, 5)

        label = QtGui.QLabel("Allegiances:")
        self.allegiancesComboBox = QtGui.QComboBox()

        allegiances = self.mydb.getAllegiances()
        self.allegiancesList = []
        self.allegiancesComboBox.addItem("Any")
        self.allegiancesList.append(None)

        for allegiance in allegiances:
            self.allegiancesComboBox.addItem(allegiance["Name"])
            self.allegiancesList.append(allegiance["id"])
        if self.mydb.getConfig("option_of_allegiances"):
            self.allegiancesComboBox.setCurrentIndex(
                self.mydb.getConfig("option_of_allegiances"))
        self.allegiancesComboBox.currentIndexChanged.connect(
            self.searchOutfitting)
        gridLayout.addWidget(label, 1, 7)
        gridLayout.addWidget(self.allegiancesComboBox, 1, 8)

        label = QtGui.QLabel("Search Range:")
        self.searchRangeSpinBox = QtGui.QSpinBox()
        self.searchRangeSpinBox.setRange(0, 1000)
        self.searchRangeSpinBox.setSuffix("ly")
        self.searchRangeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_of_maxSearchRange"):
            self.searchRangeSpinBox.setValue(
                self.mydb.getConfig("option_of_maxSearchRange"))
        else:
            self.searchRangeSpinBox.setValue(50)

        gridLayout.addWidget(label, 1, 10)
        gridLayout.addWidget(self.searchRangeSpinBox, 1, 11)

        label = QtGui.QLabel("Max Data Age:")
        self.maxAgeSpinBox = QtGui.QSpinBox()
        self.maxAgeSpinBox.setRange(1, 1000)
        self.maxAgeSpinBox.setSuffix("Day")
        self.maxAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_of_maxAge"):
            self.maxAgeSpinBox.setValue(
                self.mydb.getConfig("option_of_maxAge"))
        else:
            self.maxAgeSpinBox.setValue(1)
        gridLayout.addWidget(label, 1, 13)
        gridLayout.addWidget(self.maxAgeSpinBox, 1, 14)

        label = QtGui.QLabel("Rating:")
        self.ratingComboBox = QtGui.QComboBox()

        self.ratingComboBox.addItem("Any")
        for rating in self.outfitting.getRatingList():
            self.ratingComboBox.addItem(rating['Rating'])
        self.ratingComboBox.currentIndexChanged.connect(self.searchOutfitting)
        gridLayout.addWidget(label, 2, 1)
        gridLayout.addWidget(self.ratingComboBox, 2, 2)

        label = QtGui.QLabel("Ship:")
        self.shipComboBox = QtGui.QComboBox()
        self.shipComboBox.addItem("Any")
        self.shipList = [None]

        for ship in self.mydb.getAllShipnames():
            self.shipComboBox.addItem(ship["Name"])
            self.shipList.append(ship["id"])
        self.shipComboBox.currentIndexChanged.connect(self.searchOutfitting)
        gridLayout.addWidget(label, 2, 4)
        gridLayout.addWidget(self.shipComboBox, 2, 5)

        label = QtGui.QLabel("Governments:")
        self.governmentsComboBox = QtGui.QComboBox()

        governments = self.mydb.getGovernments()
        self.governmentsList = []
        self.governmentsComboBox.addItem("Any")
        self.governmentsList.append(None)

        for government in governments:
            self.governmentsComboBox.addItem(government["Name"])
            self.governmentsList.append(government["id"])
        if self.mydb.getConfig("option_of_governments"):
            self.governmentsComboBox.setCurrentIndex(
                self.mydb.getConfig("option_of_governments"))
        self.governmentsComboBox.currentIndexChanged.connect(
            self.searchOutfitting)
        gridLayout.addWidget(label, 2, 7)
        gridLayout.addWidget(self.governmentsComboBox, 2, 8)

        label = QtGui.QLabel("Max Star Dist:")
        self.maxStartDistSpinBox = QtGui.QSpinBox()
        self.maxStartDistSpinBox.setRange(10, 7000000)
        self.maxStartDistSpinBox.setSuffix("ls")
        self.maxStartDistSpinBox.setSingleStep(10)
        self.maxStartDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        maxStarDist = self.mydb.getConfig('option_of_maxStarDist')
        if maxStarDist:
            self.maxStartDistSpinBox.setValue(maxStarDist)
        else:
            self.maxStartDistSpinBox.setValue(1500)
        gridLayout.addWidget(label, 2, 10)
        gridLayout.addWidget(self.maxStartDistSpinBox, 2, 11)

        self.optionsGroupBox = QtGui.QGroupBox("Options")
        self.optionsGroupBox.setLayout(gridLayout)

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.searchOutfitting)

        modulLabel = QtGui.QLabel("Modul:")
        self.modulComboBox = QtGui.QComboBox()

        module = self.outfitting.getOutfittingNameList()
        self.modulList = []
        for modul in module:
            self.modulComboBox.addItem(modul["modulname"])
            self.modulList.append(modul["id"])
        self.modulComboBox.currentIndexChanged.connect(self.searchOutfitting)

        self.showOptions = QtGui.QCheckBox("Show Options")
        if self.mydb.getConfig("option_of_showOptions") != 0:
            self.showOptions.setChecked(True)
        self.showOptions.stateChanged.connect(
            self.optionsGroupBoxToggleViewAction)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.searchOutfitting)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)
        layout.addWidget(modulLabel)
        layout.addWidget(self.modulComboBox)
        layout.addWidget(self.showOptions)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        #        self.listView.setModel(self.proxyModel)
        self.listView.setSortingEnabled(True)

        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(self.optionsGroupBox)
        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)

        self.optionsGroupBoxToggleViewAction()

        return vGroupBox
    def getWideget(self):

        gridLayout = QtGui.QGridLayout()

        gridLayout.setColumnStretch(1, 1)
        gridLayout.setColumnStretch(4, 1)
        gridLayout.setColumnStretch(7, 1)

        self.onlyLocation = QtGui.QCheckBox("Only Location")
        if self.mydb.getConfig("option_cf_onlyLocation"):
            self.onlyLocation.setChecked(True)
        else:
            self.onlyLocation.setChecked(False)
        self.onlyLocation.stateChanged.connect(self.searchItem)
        gridLayout.addWidget(self.onlyLocation, 1, 0)

        self.onlyLpadsize = QtGui.QCheckBox("Only L Pads")
        if self.mydb.getConfig("option_cf_onlyLpadsize"):
            self.onlyLpadsize.setChecked(True)
        self.onlyLpadsize.setToolTip(
            "Find only stations with a large landingpad")
        self.onlyLpadsize.stateChanged.connect(self.searchItem)
        gridLayout.addWidget(self.onlyLpadsize, 2, 0)

        label = QtGui.QLabel("Search Range:")
        self.searchRangeSpinBox = QtGui.QSpinBox()
        self.searchRangeSpinBox.setRange(0, 1000)
        self.searchRangeSpinBox.setSuffix("ly")
        self.searchRangeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_cf_maxSearchRange"):
            self.searchRangeSpinBox.setValue(
                self.mydb.getConfig("option_cf_maxSearchRange"))
        gridLayout.addWidget(label, 1, 2)
        gridLayout.addWidget(self.searchRangeSpinBox, 1, 3)

        label = QtGui.QLabel("Allegiances:")
        self.allegiancesComboBox = QtGui.QComboBox()

        allegiances = self.mydb.getAllegiances()
        self.allegiancesList = []
        self.allegiancesComboBox.addItem("Any")
        self.allegiancesList.append(None)

        for allegiance in allegiances:
            self.allegiancesComboBox.addItem(allegiance["Name"])
            self.allegiancesList.append(allegiance["id"])
        if self.mydb.getConfig("option_cf_allegiances"):
            self.allegiancesComboBox.setCurrentIndex(
                self.mydb.getConfig("option_cf_allegiances"))
        self.allegiancesComboBox.currentIndexChanged.connect(self.searchItem)
        gridLayout.addWidget(label, 1, 5)
        gridLayout.addWidget(self.allegiancesComboBox, 1, 6)

        label = QtGui.QLabel("Max Data Age:")
        self.maxAgeSpinBox = QtGui.QSpinBox()
        self.maxAgeSpinBox.setRange(1, 1000)
        self.maxAgeSpinBox.setSuffix("Day")
        self.maxAgeSpinBox.setAlignment(QtCore.Qt.AlignRight)
        if self.mydb.getConfig("option_cf_maxAge"):
            self.maxAgeSpinBox.setValue(
                self.mydb.getConfig("option_cf_maxAge"))
        else:
            self.maxAgeSpinBox.setValue(14)
        gridLayout.addWidget(label, 1, 8)
        gridLayout.addWidget(self.maxAgeSpinBox, 1, 9)

        label = QtGui.QLabel("Buy/Sell:")
        self.buySellComboBox = QtGui.QComboBox()
        buySellList = ["Any", "Buy", "Sell"]
        for item in buySellList:
            self.buySellComboBox.addItem(item)
        if self.mydb.getConfig("option_cf_buySell"):
            self.buySellComboBox.setCurrentIndex(
                self.mydb.getConfig("option_cf_buySell"))
        self.buySellComboBox.currentIndexChanged.connect(self.searchItem)
        gridLayout.addWidget(label, 2, 2)
        gridLayout.addWidget(self.buySellComboBox, 2, 3)

        label = QtGui.QLabel("Governments:")
        self.governmentsComboBox = QtGui.QComboBox()

        governments = self.mydb.getGovernments()
        self.governmentsList = []
        self.governmentsComboBox.addItem("Any")
        self.governmentsList.append(None)

        for government in governments:
            self.governmentsComboBox.addItem(government["Name"])
            self.governmentsList.append(government["id"])
        if self.mydb.getConfig("option_cf_governments"):
            self.governmentsComboBox.setCurrentIndex(
                self.mydb.getConfig("option_cf_governments"))
        self.governmentsComboBox.currentIndexChanged.connect(self.searchItem)
        gridLayout.addWidget(label, 2, 5)
        gridLayout.addWidget(self.governmentsComboBox, 2, 6)

        label = QtGui.QLabel("Max Star Dist:")
        self.maxStartDistSpinBox = QtGui.QSpinBox()
        self.maxStartDistSpinBox.setRange(10, 7000000)
        self.maxStartDistSpinBox.setSuffix("ls")
        self.maxStartDistSpinBox.setSingleStep(10)
        self.maxStartDistSpinBox.setAlignment(QtCore.Qt.AlignRight)
        maxStarDist = self.mydb.getConfig('option_cf_maxStarDist')
        if maxStarDist:
            self.maxStartDistSpinBox.setValue(maxStarDist)
        else:
            self.maxStartDistSpinBox.setValue(1500)
        gridLayout.addWidget(label, 2, 8)
        gridLayout.addWidget(self.maxStartDistSpinBox, 2, 9)

        self.optionsGroupBox = QtGui.QGroupBox("Options")
        self.optionsGroupBox.setLayout(gridLayout)

        locationButton = QtGui.QToolButton()
        locationButton.setIcon(
            self.guitools.getIconFromsvg("img/location.svg"))
        locationButton.clicked.connect(self.setCurentLocation)
        locationButton.setToolTip("Current Location")

        locationLabel = QtGui.QLabel("Location:")
        self.locationlineEdit = guitools.LineEdit()
        self.locationlineEdit.setText(self.main.location.getLocation())
        self.locationlineEdit.textChanged.connect(self.searchItem)

        nameLabel = QtGui.QLabel("Name:")
        self.itemComboBox = QtGui.QComboBox()

        items = self.mydb.getAllItemNames()
        self.itemList = []
        self.itemComboBox.addItem("Any")
        self.itemList.append(None)

        for item in items:
            self.itemComboBox.addItem(item["name"])
            self.itemList.append(item["id"])
        if self.mydb.getConfig("option_cf_item"):
            self.itemComboBox.setCurrentIndex(
                self.mydb.getConfig("option_cf_item"))
        self.itemComboBox.currentIndexChanged.connect(self.searchItem)

        self.showOptions = QtGui.QCheckBox("Show Options")
        if self.mydb.getConfig("option_cf_showOptions") != 0:
            self.showOptions.setChecked(True)
        self.showOptions.stateChanged.connect(
            self.optionsGroupBoxToggleViewAction)

        self.searchbutton = QtGui.QPushButton("Search")
        self.searchbutton.clicked.connect(self.searchItem)

        layout = QtGui.QHBoxLayout()
        layout.setContentsMargins(0, 0, 0, 0)

        layout.addWidget(locationLabel)
        layout.addWidget(locationButton)

        layout.addWidget(self.locationlineEdit)
        layout.addWidget(nameLabel)
        layout.addWidget(self.itemComboBox)
        layout.addWidget(self.showOptions)

        layout.addWidget(self.searchbutton)

        locationGroupBox = QtGui.QGroupBox()
        locationGroupBox.setFlat(True)
        locationGroupBox.setStyleSheet(
            """QGroupBox {border:0;margin:0;padding:0;}  margin:0;padding:0;"""
        )

        # locationGroupBox.setFlat(True)
        locationGroupBox.setLayout(layout)

        self.listView = QtGui.QTreeView()

        #        self.proxyModel = QtGui.QSortFilterProxyModel()
        #        self.proxyModel.setDynamicSortFilter(True)

        self.listView.setRootIsDecorated(False)
        self.listView.setAlternatingRowColors(True)
        #        self.listView.setModel(self.proxyModel)
        self.listView.setSortingEnabled(True)

        self.listView.setSelectionMode(
            QtGui.QAbstractItemView.ExtendedSelection)
        self.listView.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)

        self.listView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu)
        self.listView.customContextMenuRequested.connect(
            self.myContextMenuEvent)

        vGroupBox = QtGui.QGroupBox()
        vGroupBox.setFlat(True)

        layout = QtGui.QVBoxLayout()
        layout.setContentsMargins(6, 6, 6, 6)

        layout.addWidget(self.optionsGroupBox)
        layout.addWidget(locationGroupBox)
        layout.addWidget(self.listView)

        vGroupBox.setLayout(layout)

        self.guitools.setSystemComplete("", self.locationlineEdit)

        self.optionsGroupBoxToggleViewAction()

        return vGroupBox