Beispiel #1
0
class ViewUserNotification(ModelViewFormWidget):
    MODEL = Notification

    LAYOUT_POSITION = conf.ORQUESTRA_NEW_WINDOW

    FIELDSETS = [
        '_unread', 'label', 'text',
        ('user', 'period', 'created_on', 'read_on', 'sent_on')
    ]

    def __init__(self, *args, **kwargs):
        self.text = ControlHtml('Message')
        self._unread = ControlButton(
            "<i class='icon envelope'></i>Mark as unread",
            css='orange right floated',
            label_visible=False,
            default=self.__mark_unread_evt)

        super().__init__(*args, **kwargs)

    def __mark_unread_evt(self):
        obj = self.model_object
        obj.read_on = None
        self.read_on.value = None
        obj.save()
        self._unread.hide()
        self.parent.populate_list()
Beispiel #2
0
    def __init__(self):
        super().__init__('Building Info')

        self.set_margin(10)

        self.formset = []

        self.formset.append(('Name', ' ', str(BuildingInfo.building.name)))
        self.formset.append(('Monthly Cost', ' ', '500'))
        self.formset.append(
            ('Capacity', ' ', str(BuildingInfo.building.capacity)))
        self.formset.append('Effects:')

        effs = BuildingInfo.building.effects

        # Change a string into a list of string
        if type(effs) == str:
            if len(effs) > 40:
                effs = wrap_text(effs, 40)
            else:
                effs = [effs]

        for eff in effs:
            self.formset.append(str(eff))

        self.upgrade = ControlButton('Upgrade!')
        self.upgrade.value = self.upgrade_click
        self.formset.append('upgrade')
        self.destroy = ControlButton('Destroy')
        self.destroy.value = self.destroy_click
        self.formset.append('destroy')
Beispiel #3
0
    def _widgets(self):
        """Insight GUI items for operation and status display"""
        # Action and error log from parent Controller class
        Controller._widgets(self)

        # Emission and shutter operation
        self.emission_button = ControlButton('Laser Off')
        self.emission_button.value = self._emission
        self.main_shutter_button = ControlButton('Main Shutter Closed')
        self.main_shutter_button.value = self._main_shutter_control
        self.fixed_shutter_button = ControlButton('1040 nm Shutter Closed')
        self.fixed_shutter_button.value = self._fixed_shutter_control

        # OPO Tuning
        self.tune_wl_val = ControlText('Set Wavelength (nm):')
        self.tune_wl_button = ControlButton('Set')
        self.tune_wl_button.value = self._tune_wl
        self._main_wl_label = ControlLabel('Main Wavelength (nm): %s' \
                                                            % str(self.opo_wl))

        # Define statistics displays
        self._stats_labels()

        self._state_label = ControlLabel('%s' % (self.state))

        # Stored buffer with fault codes
        self._code_history = ControlTextArea('Status Buffer History')
        self._code_history.readonly = True
    def __init__(self, _project=None):
        BaseWidget.__init__(self, self.TITLE, parent_win=_project)
        AlyxModule.__init__(self)

        self.project = _project

        self._addressbox = ControlText('Address')
        self._username = ControlText('User:'******'Password:'******'User:'******'Password:'******'Connect', default=self._connect)
        self._status_lbl = ControlLabel('Status: Not Connected')
        self._getsubjects_btn = ControlButton('Get Subjects',
                                              default=self._get_subjects)
        self._getsubjects_btn.enabled = False
        self.set_margin(10)

        self._addressbox.value = conf.ALYX_PLUGIN_ADDRESS
        self._addressbox.changed_event = self.setaddr

        if self.project.loggeduser is not None:
            self._username.value = self.project.loggeduser.name

        self._password.form.lineEdit.setEchoMode(QLineEdit.Password)

        self.formset = [
            '_addressbox', '_username', '_password', '_connect_btn',
            '_status_lbl', '_getsubjects_btn'
        ]
Beispiel #5
0
    def _expmt_widgets(self):
        """Experiment specific GUI objects.  Separate from device GUI objects"""
        # Experiment history log from parent Experiment class
        Experiment._expmt_widgets(self)
        self._wl_label = ControlLabel('Main Wavelength: %s' \
                                                % (str(self._insight.opo_wl)))
        self._omega_text = ControlText('Raman Shift (cm-1):')
        self._omega_text.value = '%.2f' % (self._omega)
        self._set_omega_button = ControlButton('Set Omega')
        self._set_omega_button.value = self._set_omega

        self._dwell_text = ControlText('Pixel Dwell Time (us):')
        self._dwell_text.value = '2'
        self._set_dwell_button = ControlButton('Set Lockin')
        self._set_dwell_button.value = self._set_dwell

        self._optimize_button = ControlButton('Optimize Signal')
        self._optimize_button.value = self._optimizer

        self._tuned_spectrum_button = ControlButton('Tuned Spectrum')
        self._tuned_spectrum_button.value = self._tuned_spectrum

        self._img = ControlMatplotlib(value=np.zeros([512, 512]))
        self._acquire_button = ControlButton('Acquire Image')
        self._acquire_button.value = self._rtd

        self._expmt_panel.value = [
            self._wl_label, self._dwell_text, self._set_dwell_button,
            self._omega_text, self._set_omega_button, self._optimize_button,
            self._acquire_button, self._tuned_spectrum_button, self._img,
            self._expmt_history
        ]
    def __init__(self, task=None, when=None, command=None):
        title = "Post command editor" if when == TaskCommand.WHEN_POST else "Pre command editor"
        BaseWidget.__init__(self, title, parent_win=task)
        self.command = command
        self.task = task
        self.when = when
        self.set_margin(5)

        self._type = ControlCombo('Type of command',
                                  changed_event=self.__type_changed_evt)
        self._cancelbtn = ControlButton('Cancel', default=self.__cancel_evt)
        self._okbtn = ControlButton('Ok', default=self.__ok_evt)

        self._command = ControlText('External command', visible=False)
        self._filesbrowser = ControlTreeView('Files browser')

        self._type.add_item('Execute a gui script', 'script')
        self._type.add_item('Execute a external command', 'external')

        self.formset = [
            '_type', '_command', '_filesbrowser',
            (' ', '_cancelbtn', '_okbtn'), ' '
        ]

        root_path = os.path.abspath(task.path if task else '/')
        self.syspath_model = QFileSystemModel(self)
        self.syspath_model.setRootPath(root_path)
        self.syspath_model.setNameFilters(['*.py'])
        self.syspath_model.setNameFilterDisables(False)
        self._filesbrowser.value = self.syspath_model

        root_index = self.syspath_model.index(root_path)
        self._filesbrowser.setRootIndex(root_index)
        for i in range(1, 4):
            self._filesbrowser.hideColumn(i)
Beispiel #7
0
    def __init__(self):
        super(Gupload, self).__init__('Gupload')

        #Definition of the forms fields
        self._dropdown = ControlCombo('Local Folder')
        self._plusbutton = ControlButton('Add New Team')
        self._button = ControlButton('Upload Files')
        self._progress = ControlText('Progress')
        #self.panel          = ControlEmptyWidget()
        self._dict = {}

        self.picklefilename = Path(config_dir, 'foldloc.dat')
        if not os.path.exists(config_dir):
            os.mkdir(config_dir)

        if self.picklefilename.exists():
            self.load()
        else:
            f = open(self.picklefilename, 'wb')
            pickle.dump({}, f)
            f.close()
            self.load()

        #Define the button action
        self._button.value = self.__buttonAction
        self._plusbutton.value = self.__plusbuttonAction
    def __init__(self, _project):
        BaseWidget.__init__(self, self.TITLE)
        AlyxModule.__init__(self)
        User.__init__(self, _project)

        self.project = _project
        
        self._namebox = ControlText('User:'******'Password:'******'Connect',default = self._connect)
        self._status_lbl = ControlLabel('Status: Not Connected')
        self._getsubjects_btn = ControlButton('Get Subjects', default = self._get_subjects)

        self.set_margin(10)

        self._namebox.value = self._name

        self._namebox.changed_event = self.__name_changed_evt
        
        self._password.form.lineEdit.setEchoMode(QLineEdit.Password)

        self.formset = [
            '_namebox',
            '_password',
            '_connect_btn',
            '_status_lbl',
            '_getsubjects_btn'
        ]

        self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
    def __init__(self, *args, **kwargs):
        super().__init__("Gateway Helper")

        self.set_margin(20)

        if getattr(sys, 'frozen', False):
            self.application_path = os.path.dirname(sys.executable)
        elif __file__:
            self.application_path = os.path.dirname(__file__)

        # cwd = os.getcwd()
        self.cwd = self.application_path
        # print()
        # print(cwd)
        # print()
        # self.cartsDir = os.path.join(self.cwd, "Carts")

        os.environ["PATH"] += os.pathsep + self.cwd

        self._vendor = ControlText('Vendor (Use exactly what Gateway does)')
        self._cart = ControlFile('Cart Excel File')
        self._runbutton = ControlButton('Run')
        self._cancelbutton = ControlButton('Cancel')

        self._vendor.changed_event = self.__vendorSelectEvent
        self._cart.changed_event = self.__cartSelectEvent

        self._runbutton.value = self.__runEvent
        self._cancelbutton.value = self.__cancelEvent

        self._formset = [('_vendor'), '_cart', ("_runbutton", '_cancelbutton')]

        self.fileOkay = False
        self.vendorOkay = False
        self.df = pd.DataFrame()
Beispiel #10
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.resource.field_css = 'eleven wide'

        self._until = ControlDateTime('Access until', visible=False)
        self._acceptbtn = ControlButton('Accept',
                                        default=self.__accept_evt,
                                        css='basic green',
                                        visible=False)
        self._rejectbtn = ControlButton('Reject',
                                        default=self.__reject_evt,
                                        css='red',
                                        visible=False)

        req = self.model_object
        if req.is_approved() is None:
            self._acceptbtn.show()
            self._rejectbtn.show()
            self._until.show()
            self.closed_by.hide()
            self.closed_on.hide()
        else:
            self._until.hide()
            self.closed_by.show()
            self.closed_on.show()
            self.comment.readonly = True
Beispiel #11
0
    def __init__(self):
        #    print("it is running")
        super(Window_1, self).__init__('window 1')
        #    print("it is running")

        #self.second_window = Window_2()

        self.day_current = 1

        self.controller = master.Controller()

        self.graph_button = ControlButton("show the graph")
        self.days = ControlText('how many days have passed')
        self.random_event_button = ControlButton('enter')
        self.save_population_button = ControlButton('save the population')
        self.other_window_button = ControlButton('other window')

        self.graph_button.value = self.make_graph  #utils.send_to_plot(self.controller.populationBlocks))
        self.random_event_button.value = self.call_random_event
        self.save_population_button.value = self.controller.saveBlocks
        self.other_window_button.value = self.open_other_window
        #self.label = ControlTextArea(utils.labelgraphPrint(self.controller.populationBlocks, [-10,10,-10,10]), font_size=14)
        #self.timeline = ControlEventTimeline("timeline1")

        #BaseWidget.generate_tabs(dictionary)
        self.mainmenu = [{
            'File': [{
                'exit': exit()
            }, {
                'test1': self.__buttonAction()
            }]
        }]
Beispiel #12
0
    def __init__(self, *args, **kwargs):
        super().__init__('4-Cam')

        self.set_margin(10)

        # Definition of the forms fields
        self._player1 = ControlPlayer('Player1')
        self._player2 = ControlPlayer('Player2')
        self._player3 = ControlPlayer('Player3')
        self._player4 = ControlPlayer('Player4')
        self._runbutton = ControlButton('Stop')
        self._screenshot = ControlButton('Screenshot')
        self._outputfile = ControlDir('Screenshots Ausgabe Ordner')
        self._cams = ControlCheckBoxList('Kameras')

        # Define the event that will be called when the run button is processed
        self._runbutton.value = self.__stopEvent
        self._screenshot.value = self._saveImages

        self.__check_all_avaliable_cameras()

        self.formset = [{
            '0-Kameras': [('_runbutton'), ('_player1', '_player2'),
                          ('_player3', '_player4')],
            '1-Einstellungen': [('_outputfile'), ('_cams')]
        }]

        self._player1.value = self.__assign_capture(0)
        self._player2.value = self.__assign_capture(1)
        self._player3.value = self.__assign_capture(2)
        self._player4.value = self.__assign_capture(3)

        self._outputfile.value = os.getcwd()

        self.__runEvent()
Beispiel #13
0
    def __init__(self):
        super(FundCalculatorGUI, self).__init__('FundCalculatorGUI')

        self.daily_report = ControlLabel()

        self.current_fund = ControlLabel('Current Fund:')
        self.fund_code = ControlText('Fund Code:')
        self.fund_amount = ControlText('Fund Amount:')
        self.add_fund_button = ControlButton('Add Fund')
        self.add_fund_button.value = self.add_fund

        self.sender_address = ControlText('Sender Address:')
        self.sender_password = ControlText('Sender Password:'******'Receiver Address:')

        self.current_status_label = ControlLabel('Current Status:')
        self.current_status = ControlLabel(
            time.strftime('%Y-%m-%d %H:%M', time.localtime(time.time())) +
            ' Program is not running...' + ' ' * 10)

        self.button = ControlButton('OK')
        self.button.value = self.button_action

        self.set_margin(15)
        self.formset = [{
            'Daily Report': ['daily_report'],
            'Fund List':
            ['current_fund', ('fund_code', 'fund_amount'), 'add_fund_button'],
            'Settings': [('sender_address', 'sender_password'),
                         'receiver_address',
                         ('current_status_label', 'current_status'), 'button']
        }]
Beispiel #14
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._topics = ControlMultipleSelection('Topics')
        self._subjects = ControlMultipleSelection('Subjects')
        self._refresh_btn = ControlButton('<i class="filter icon"></i> Filter',
                                          default=self.render_html,
                                          label_visible=False)
        self._mytopics_btn = ControlButton(
            '<i class="plus icon"></i><i class="certificate icon"></i> Add my topics',
            default=self.__add_mytopics,
            css='basic',
            label_visible=False)
        self._htmlcontrol = ControlTemplate(
            'Timeline', template='timeline/funding-opportunities.html')

        self.formset = [('_topics', '_subjects'),
                        no_columns('_mytopics_btn', '_refresh_btn'),
                        '_htmlcontrol']

        self.__load_topics()
        self.__load_subjects()

        self.render_html(False)

        request = PyFormsMiddleware.get_request()
        self.fund_id = request.GET.get('fund', None)
    def __init__(self):
        super(youPyDownloader, self).__init__('youtube downloader')

        #definatino of forms fields
        self._videoUrl = ControlText('Video Url')
        self._button = ControlButton('View Details')
        self._details = ControlTextArea("Details")
        self._downloadButton = ControlButton("Download")

        self._downloadCompleted = ControlLabel(" ")

        self._button.value = self.__buttonAction
        self._downloadButton.value = self.__downloadAction

        self.formset = [('_videoUrl'), '_button', '_details',
                        '_downloadButton', '_downloadCompleted']
        #The ' ' is used to indicate that a empty space should be placed at the bottom of the window
        #If you remove the ' ' the forms will occupy the entire window
        self.mainmenu = [{
            'File': [{
                "Downloaded Files": self.__viewDownloaded
            }, {
                'About': self.__about
            }, '-', {
                'Quit': self.__quit
            }]
        }]
Beispiel #16
0
    def __init__(self):
        super().__init__('Construct New Building')

        self.formset = []
        self.set_margin(10)
        lot = BuyBuilding.lot
        building_list = Map.getList()

        # Create list of functions to buy the buildings
        i = 0
        bboxes = []
        leftside = []

        self._buttons = [None] * 7
        self.buyfuncs = [None] * 7

        def get_buy_func(building):
            def buy():
                if global_vars.university.buy(building.constructionCost):
                    global_vars.map.construct_building(lot.pos, building)
                KeyStroker.AltF4()

            return buy

        for building in building_list:

            self.buyfuncs[i] = None
            #b1box = ControlToolBox()
            #b1box.value = []
            b1box = []
            b1box.append(building.name)
            effects = wrap_text(building.effects, 60)
            for eff in effects:
                b1box.append(eff)
            b1box.append('Price: $' + str(building.constructionCost))
            b1box.append('Build Time: ' + str(building.constructionTime) +
                         ' months')
            buy_button = ControlButton("Begin Construction")
            buy_button.value = get_buy_func(building)
            self._buttons[i] = buy_button

            b1box.append('_button' + str(i + 1))
            bboxes.append(b1box)

            if i % 2 == 0:
                leftside = bboxes[i]
            else:
                self.formset.append((leftside, ' ', bboxes[i]))
            i += 1

        if i % 2 == 1:
            self.formset.append((' ', leftside, ' '))

        self._button1 = self._buttons[0]
        self._button2 = self._buttons[1]
        self._button3 = self._buttons[2]
        self._button4 = self._buttons[3]
        self._button5 = self._buttons[4]
        self._button6 = self._buttons[5]
        self._button7 = self._buttons[6]
Beispiel #17
0
    def __init__(self):
        super().__init__('Teachers')

        self.set_margin(10)
        self.formset = []
        university = global_vars.university
        teacher = TeacherMenu.teacher

        def hire():
            university.can_hire = False
            teacher.hire()
            KeyStroker.AltF4()

        def skip():
            university.can_hire = False
            KeyStroker.AltF4()

        if not (university.can_hire
                and len(university.teachers) < university.max_teachers()):
            self.formset.append(
                'Sorry, you may not hire more teachers at this time')
        else:
            self.formset.append('You may hire a new teacher!')
            self.formset.append('Name: Dr. ' + teacher.name)
            self.formset.append('Monthly Salary: $' + str(teacher.salary))
            self.formset.append('Research Rating: ' + str(teacher.research))
            self.formset.append('Teaching Rating: ' + str(teacher.teaching))
            self._hirebutton = ControlButton('Hire')
            self._hirebutton.value = hire
            self._passbutton = ControlButton('Pass')
            self._passbutton.value = skip
            self.formset.append(('_hirebutton', ' ', '_passbutton'))
Beispiel #18
0
    def __init__(self, video):
        IModelGUI.__init__(self)
        Object2D.__init__(self, video)
        BaseWidget.__init__(self, '2D Object', parent_win=video)

        self._addpath = ControlButton('Add path')
        self._addcontours = ControlButton('Add contours')
        self._addvalues = ControlButton('Add values')
        self._removeobj = ControlButton('Remove')

        self.formset = [
            '_name',
            #('_addpath', '_addcontours'),
            #'_addvalues',
            '_removeobj',
            ' '
        ]

        self._addpath.icon = conf.ANNOTATOR_ICON_ADD
        self._removeobj.icon = conf.ANNOTATOR_ICON_REMOVE
        self._addcontours.icon = conf.ANNOTATOR_ICON_CONTOUR
        self._addvalues.icon = conf.ANNOTATOR_ICON_CONTOUR

        self._addpath.value = self.create_path
        self._addcontours.value = self.create_contours
        self._addvalues.value = self.create_value
        self._removeobj.value = self.__remove_object

        self.create_tree_nodes()
Beispiel #19
0
	def __init__(self, title='Variables graphs'):
		super(GraphApp,self).__init__(title)

		self._graph   	  = ControlVisVis("Graph")
		self._toggleVars  = ControlButton('Show/Hide variables', checkable=True)
		self._loadGraph   = ControlButton('Apply')
		self._varsList	  = ControlCheckBoxList('Variables')

		self._varsList += ('Frames',True)
		self._varsList += ('X',True)
		self._varsList += ('Y',True)
		self._varsList += ('Z',False)
		self._varsList += ('Velocity',False)
		self._varsList += ('Acceleration',False)

		self._modules_tabs.update({
			'Graphs': [ 
				('_toggleVars',' '),
				'_varsList',
				'_loadGraph',
				'_graph'],
		})
		
		
		self._loadGraph.value 	= self.__calculate_graph
		self._toggleVars.value = self.__show_hide_variables
		self._varsList.hide()
		self._loadGraph.hide()
Beispiel #20
0
 def __init__(self):
     BaseWidget.__init__(self, "RIST-ng v%s \"%s\"" % (Version, Codename))
     self._show_project()
     self.formset = [('_IoC', '_min', '_full', '_settings'), ' ']
     self._IoC = ControlText("IoC: ")
     self._min, self._min.value = ControlButton("Min"), self._minACTION
     self._full, self._full.value = ControlButton("Full"), self._fullACTION
     self._settings, self._settings.value = ControlButton(
         "Settings"), self._settingsACTION
Beispiel #21
0
    def __init__(self):
        # Class Vars:
        self.__players = []  # List of players

        # Player Setup Tab -- Init UI Elements
        #super(MBUI, self).__init__("Millennium Blades Helper")
        BaseWidget.__init__(self, "Millennium Blades Helper")
        self._lstPlayers = ControlList('Player List')
        self._btnAddPl = ControlButton('Add Player')
        self._btnRemPl = ControlButton('Remove Selected Player')
        self._btnGenPl = ControlButton('Generate Player Setup')

        # Player Setup Tab -- Set up properties of UI elements, attach callbacks, etc.
        self._lstPlayers.horizontal_headers = [
            'Name', 'Character', 'Starter Deck'
        ]
        self._btnAddPl.value = self.__onAddPlayerClick
        self._btnRemPl.value = self.__onRemoveSelectedPlayerClick
        self._btnGenPl.value = self.__onGeneratePlayerSetupClick

        # Store Setup Tab -- Init UI Elements
        self._lstStore = ControlList('Store Components')
        self._ckAreaLabel = ControlLabel('Sets To Use')
        self._btnGenerateSt = ControlButton('Generate Store')

        # Store Setup Tab -- Set up properties of UI elements, attach callbacks etc.
        self._lstStore.horizontal_headers = ['Category', 'Sets']
        self._btnGenerateSt.value = self.__onGenerateStoreClick

        # Scoring Tab -- Init UI Components
        self._scoringPanel = ControlEmptyWidget()
        self._btnGetScoring = ControlButton('Generate Score Sheet')

        # Scoring Tab -- Set up properties of UI elements, attach callbacks etc.
        self._btnGetScoring.value = self.__onGenerateScoringClick

        # Set Selection Tab -- Init UI Components
        self._chkArea = ControlCheckBoxList('Sets To Use')

        # Set Selection Tab -- Set up properties of UI elements, attach callbacks etc.
        self._chkArea += ('Base Set', True)
        self._chkArea += ('Set Rotation', True)
        self._chkArea += ('MX #1: Crossover', True)
        self._chkArea += ('MX #2: Sponsors', True)
        self._chkArea += ('MX #3: Fusion Chaos', True)
        self._chkArea += ('MX #4: Final Bosses', True)
        self._chkArea += ('MX #5: Futures', True)
        self._chkArea += ('MX #6: Professionals', True)

        # Set up tabs and component flow for UI
        self.formset = [{
            '1. Player Setup':
            ['_lstPlayers', ' ', ('_btnAddPl', '_btnRemPl', '_btnGenPl')],
            '2. Store Setup': ['_lstStore', ' ', '_btnGenerateSt'],
            '3. Scoring': ['_scoringPanel', '_btnGetScoring'],
            '4. Set Selection': ['_chkArea']
        }]
Beispiel #22
0
    def __init__(self, *args, **kwargs):
        self.text = ControlHtml('Message')
        self._unread = ControlButton(
            "<i class='icon envelope'></i>Mark as unread",
            css='orange right floated',
            label_visible=False,
            default=self.__mark_unread_evt)

        super().__init__(*args, **kwargs)
Beispiel #23
0
    def __init__(self, *args, **kwargs):
        super().__init__('Computer vision algorithm example')

        #Definition of the forms fields
        self._import_button = ControlButton("Import POI csv")
        self._show_map = ControlButton("Show Map")

        #Set actions
        self._show_map.value = self.__show_map_action
Beispiel #24
0
    def __init__(self, *args, **kwargs):

        #settings.PYFORMS_STYLESHEET = "style.css"

        super().__init__("EKOHEX Loader GUI v1.0 - Maciej Nachtygal")

        # Definition of the forms fields

        self._uC = ControlCombo("Mikrokontroler: ")
        items = ["Wybierz...", "Attiny 10", "Attiny 13", "Attiny 24"]
        for item in items:
            self._uC.add_item(item)
        self._clock = ControlCombo("Ust. zegara: ")
        self._upload = ControlCombo("Częst. wgrywania: ")
        items = [
            "2 kHz", "4 kHz", "8 kHz", "16 kHz", "32 kHz", "93.75 kHz",
            "187 kHz", "375 kHz", "750 kHz", "1500 kHz"
        ]
        for item in items:
            self._upload.add_item(item)

        self._hexfile = ControlFile("Wybierz plik .hex : ")
        self._reapeat = ControlCheckBox("produkcja")
        self._reapeatInput = ControlText("Ilość: ")
        self._reapeatInput.enabled = False
        self.repeatStatus = self._reapeatInput.enabled

        self._progress = ControlProgress()
        self._progress.min = 0
        self._progress.max = 100
        self.progressStatus = 0

        self._startButton = ControlButton("Start")
        self._stopButton = ControlButton("Stop")
        self.stop = False

        self._logBox = ControlTextArea("Log:")
        self._logBox.readonly = True
        self._logBox.autoscroll = True
        self._logBox.value = "Program gotowy do działania!\n"
        self.avrdudeInfo = ""

        # Define the function that will be called when a file is selected
        self._hexfile.changed_event = self.__hexFileSelectionEvent
        self._uC.changed_event = self.__uCSelectionEvent
        self._clock.changed_event = self.__clockSelectionEvent
        self._upload.changed_event = self.__uploadSelectionEvent
        self._reapeat.changed_event = self.__reapeatSelectionEvent
        self._reapeatInput.changed_event = self.__valueUpdateSelectionEvent
        self._startButton.value = self.__startSelectionEvent
        self._stopButton.value = self.__stopSelectionEvent
        # Define the organization of the Form Controls
        self._formset = [("_hexfile"), ("_uC", "_clock"),
                         ("_upload", "_reapeat", "_reapeatInput"),
                         ("_progress"), ("_startButton", "_stopButton"),
                         "_logBox"]
Beispiel #25
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._contractsbtn = ControlButton('Maintenance contracts', label_visible=False)
        self._accessesbtn = ControlButton('Users accesses', label_visible=False)

        self.__require_access_changed_evt()

        #self.req_access.label_visible = False
        self.req_access.changed_event = self.__require_access_changed_evt
    def __init__(self, title, message, action):
        super().__init__(title=title)

        self._y_btn = ControlButton('Yes', css='positive', default=action)
        self._n_btn = ControlButton('No', css='negative', default=self.close)

        self.formset = [
            message,
            no_columns('_y_btn', '_n_btn')
        ]
 def __init__(self, message='', sub_message='', type_flag=''):
     super().__init__('Confirm')
     self._yes = ControlButton('Yes')
     self._yes.value = self._confirm
     self._no = ControlButton('No')
     self._no.value = self._close
     self._formset = [(' ', '||', str(message), '||', ' '),
                      (' ', '||', str(sub_message), '||', ' '),
                      (' ', '||', '_yes', '||', ' ', '||', '_no', '||', ' ')
                      ]
Beispiel #28
0
    def __init__(self):
        super().__init__('Upgrade Building')

        self.formset = []
        prog_map = global_vars.programs
        building = UpgradeBuilding.building

        progs = prog_map[building.name]

        def buy1():
            progs[0].trigger()
            KeyStroker.AltF4()

        def buy2():
            progs[1].trigger()
            KeyStroker.AltF4()

        def buy3():
            progs[2].trigger()
            KeyStroker.AltF4()

        def buy4():
            progs[3].trigger()
            KeyStroker.AltF4()

        buycmd = [buy1, buy2, buy3, buy4]
        buttons = [None, None, None, None]

        b = ControlButton("test")
        print(b)

        def get_buy_func(index):
            return buycmd[index]

        p = 0
        self.formset.append('Pick a program to implement in the ' +
                            str(building.name))
        for prog in progs:
            self.formset.append(prog.title)
            self.formset.append(prog.desc)

            if prog.unlocked:
                button = ControlButton("Implement this program")
                button.value = get_buy_func(p)
                buttons[p] = button
                self.formset.append('_button' + str(p + 1))
            else:
                self.formset.append("Program already implemented")
            p += 1

        self._button1 = buttons[0]
        self._button2 = buttons[1]
        self._button3 = buttons[2]
        self._button4 = buttons[3]
Beispiel #29
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        obj = self.model_object

        self._revokebtn = ControlButton(
            'Revoke access',
            default=self.__revoke_btn_evt,
            css='red',
            label_visible=False,
            visible=(obj.end_date is None
                     or obj.end_date >= timezone.now().date()))
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self._start = ControlDate('Start')
        self._end = ControlDate('End')
        self._groups = ControlAutoComplete('Groups',
                                           multiple=True,
                                           queryset=Group.objects.all())
        self._costcenters = ControlAutoComplete(
            'Cost centers', multiple=True, queryset=CostCenter.objects.all())
        self._projects = ControlAutoComplete('Projects',
                                             multiple=True,
                                             queryset=Project.objects.all())
        self._applybtn = ControlButton('Apply', default=self.populate_report)

        self._updategraphs_btn = ControlButton('Update graphs',
                                               default=self.populate_graphs)
        self._projs_pie = ControlPieChart('Projects')
        self._grps_pie = ControlPieChart('Groups')
        self._fellow_pie = ControlPieChart('Fellowship type')
        self._amount_chart = ControlBarsChart('Amount per date')

        self._list = ControlQueryList(
            'List',
            rows_per_page=15,
            headers=[
                'Person', 'Contract:Start', 'Contract:Until',
                'Contract:Salary', 'Contract:Ref', 'Contract:Position',
                'Contract:Fellowship type', 'Contract:Fellowship ref',
                'Paid:Amount', 'Paid:Start', 'Paid:Until', 'Paid:Req. num.',
                'Paid:Req. created', 'C.C. Group', 'C.C.', 'Proj.', 'Grant'
            ],
            list_display=[
                'contract__person', 'contract__start', 'contract__end',
                'contract__salary', 'contract__ref', 'contract__position',
                'contract__fellowship_type', 'contract__fellowship_ref',
                'total', 'start', 'end', 'order__requisition_number',
                'order__requisition_date', 'project__costcenter__group',
                'project__costcenter__code', 'project__code', 'project__grant'
            ])

        self.formset = [
            no_columns('_start', '_end', '_groups', '_costcenters',
                       '_projects', '_applybtn'),
            segment('_list'),
            (segment('h2:Amount per projects', '_projs_pie', css='overflow'),
             segment('h2:Amount per groups', '_grps_pie', css='overflow')),
            (segment('h2:Amount per fellowship', '_fellow_pie',
                     css='overflow'), ' '),
            segment('_amount_chart', css='overflow'),
        ]