def setup_control_panel(self): """ Inicjalizuje panel kontrolny. """ self.control_panel_top.clear() self.control_panel_bottom.clear() self.description_button = self.control_panel_top.add_button( "Opis", Paths.icon("bookmark.png")) self.description_button.clicked.connect(self.show_description) self.description_button.set_hint("Wyświetlenie opisu algorytmu.") self.visualisation_button = self.control_panel_top.add_button( "Wizualizacja", Paths.icon("eye.png")) self.visualisation_button.clicked.connect(self.show_visualisation) self.visualisation_button.set_hint( "Wizualizacja podstawowych operacji na rzecz danego algorytmu.") self.codes_button = self.control_panel_top.add_button( "Kody źródłowe", Paths.icon("code.png")) self.codes_button.clicked.connect(self.show_codes) self.codes_button.set_hint("Przejście do panelu z kodami źródłowymi.") self.questions_button = self.control_panel_top.add_button( "Pytania", Paths.icon("question_mark.png")) self.questions_button.clicked.connect(self.show_questions) self.questions_button.set_hint( "Panel weryfikujący zdobytą przez użytkownika wiedzę.") self.questions_button = self.control_panel_top.add_button( "Ustawienia", Paths.icon("settings.png")) self.questions_button.clicked.connect(self.show_settings) self.questions_button.set_hint( "Panel pozwalający dostosować użytkowanie aplikacji.")
def show_question(self, question: TestQuestion, algorithm, show_explanation=False): """ Wyświetla pytanie. Parametry: parent - widget rodzic. question - pytanie, obiekt klasy TestQuestion. algorithm - nazwa algorytmu show_explanation - określa czy wyświetlić uzasadnienie. """ self.question.setText(question.question) image_path = Paths.test_question_image(algorithm, question.image) if not os.path.isfile(image_path): image_path = Paths.icon("question_mark.png") pixels = QPixmap(image_path) self.image.setPixmap(pixels) self.image.resize(pixels.width(), pixels.height()) if show_explanation: self.explanation.setText(question.explanation) for index, answer in enumerate(question.answers): button = self.answers[index] button.set_text(answer)
def do_GET(self): self.send_response(200) if (re.match('/http(.+)', self.path)): url = re.findall(r'/(.+)', self.path)[0] try: outputYoutubeDl = subprocess.check_output([ Paths().getYdlLocation(), '-g', '--get-filename', '--no-playlist', '-f', 'best', '--no-check-certificate', url ]) getVars = outputYoutubeDl.split('\n') if len(getVars) > 3: #'URL','Name','' self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write('<h2>Unsupported url</h2>') self.wfile.write( '<p>Unexpected response from youtube-dl</p>') else: trueUrl = getVars[0] nameExt = getVars[1] req = urllib2.urlopen(trueUrl, context=Paths().getSslCtx()) reqType = req.info().getheader('Content-Type') reqLength = req.info().getheader('Content-Length') self.send_header('Content-type', reqType) self.send_header('Content-Length', reqLength) self.send_header('Content-Disposition', 'attachment; filename="' + nameExt + '"') self.end_headers() while True: chunk = req.read(524288) #512*1024 if not chunk: break self.wfile.write(chunk) except: self.send_header('Content-type', 'text/html') self.end_headers() self.wfile.write('<h2>Unsupported url</h2>') self.wfile.write('<p>youtube-dl can\'t find video URL</p>') else: self.send_header('Content-type', 'text/html') self.end_headers() output = 'Download videos from some video platforms via http requests using youtube-dl<br /><br />' output += 'USAGE:<br />' output += 'http://localhost:49149/URL VIDEO<br /><br />' output += 'LINKS:<br />' output += '<a href="https://github.com/rg3/youtube-dl">youtube-dl</a><br />' output += '<a href="https://github.com/r4mos/youtube-dl-simple-server">youtube-dl-simple-server</a>' self.wfile.write(output) return
def _src_to_multitree( self, num, paths, graph, src ): # the difficulties are to set all the routing command effectively pt = Paths() self._head_multi_tree(num, paths, graph, src) self.src_to_multi = pt._uni_path(graph, src, self.multi_head) # print self.src_to_multi return
def setup_control_panel(self): """ Inicjalizuje panel kontrolny. """ self.center.set_widget(self.algorithm.visualization_widget) description = DescriptionLabel(self.center) description.set_text( "Skorzystaj z panelu po prawej stronie, aby rozpocząć wizualizację." ) self.center.set_bottom_widget(description) self.description_widget = self.center.bottom_widget for control in self.algorithm.controls: control_type = control[0] if control_type == "BUTTON": title, callback, icon, hint, update = control[1:] button = self.control_panel_bottom.add_button(title, icon) button.clicked.connect(callback) if update: button.clicked.connect(self.on_click_last_snapshot) button.clicked.connect(self.clear_textboxes) button.set_hint(hint) self.internal_widgets.append(button) elif control_type == "TEXTBOX": label_text, callback, hint, update = control[1:] label = self.control_panel_bottom.add_label(label_text) textbox = self.control_panel_bottom.add_text_box(hint) textbox.textChanged.connect(callback) if update: textbox.textChanged.connect(self.on_click_last_snapshot) self.internal_widgets.append(label) self.internal_widgets.append(textbox) else: print("Unknown control type") self.icon_panel = self.control_panel_bottom.add_icon_panel() self.first_step_button = self.icon_panel.add_button( Paths.icon("first.png"), "Uruchomienie pierwszego kroku.") self.first_step_button.clicked.connect(self.on_click_first_step) self.previous_step_button = self.icon_panel.add_button( Paths.icon("backward.png"), "Uruchomienie poprzedniego kroku.") self.previous_step_button.clicked.connect(self.on_click_previous_step) self.play_button = self.icon_panel.add_button(Paths.icon("play.png")) self.play_button.clicked.connect(self.on_click_play) self.next_step_button = self.icon_panel.add_button( Paths.icon("forward.png"), "Uruchomienie następnego kroku.") self.next_step_button.clicked.connect(self.on_click_next_step) self.last_snapshot_button = self.icon_panel.add_button( Paths.icon("last.png"), "Uruchomienie ostatniego kroku.") self.last_snapshot_button.clicked.connect(self.on_click_last_snapshot)
def makeTimePathDictionary(G, seeds): """ create a dictionary that holds all the time values needed to walk through a path """ pathObj = Paths() pathSet = pathObj.findAllPaths(pG, seeds) timePathD = dict() for path in pathSet: timePathD[path] = calculateTime(G, path) return timePathD
def __load_test(self): """ Metoda importująca pytania testowe do algorytmu. """ self.test_questions = [] test_path = Paths.test(self.name) self.test_questions = TestQuestion.from_file(test_path)
def _extract(self): """ extract my paths by using infects/utils to search for paths using given signature signatures: signature of the package. for example, the name of the executable. derivedFrom: name of the package from which the paths of this package could be derived """ signatures = self._hintsToFindPaths derivedFrom = self._derivedFrom if not isinstance(signatures, dict): raise ValueError, "expect a dictionary of signatures for finding a package" self.signatures = signatures #for firendly output base_desc = self.description desc_format_str = 'path to %s directory of ' + base_desc #find out paths self.root = root = self.getRoot(desc_format_str, derivedFrom) include = self.getSubdirectory('c headers', desc_format_str) clib = self.getSubdirectory('c libraries', desc_format_str) python = self.getSubdirectory('python modules', desc_format_str) from Paths import Paths return Paths( self.name, root=root, includes=[include], clibs=[clib], modules=[python], description=self.description, origin=self.mechanism, )
def find(): from Paths import Paths paths = Paths(name, description="Linear Algebra PACKage", origin='search liblapack.so using infect utils', clibs=liblist) return paths
def find(): from Paths import Paths paths = Paths(name, description="I77 lib", origin='search libI77 using infect utils', clibs=liblist) return paths
def setup_ui(self): """ Inicjalizacja interfejsu użytkownika. """ self.image = QLabel(self) self.image.setAlignment(Qt.AlignCenter) self.widget_layout.addWidget(self.image) self.question = QLabel(self) self.question.setWordWrap(True) self.question.setAlignment(Qt.AlignCenter) self.widget_layout.addWidget(self.question) self.explanation = QLabel(self) self.explanation.setWordWrap(True) self.explanation.setAlignment(Qt.AlignCenter) self.widget_layout.addWidget(self.explanation) for l in ["A", "B", "C", "D"]: answer = AnswerButton(self) answer.set_icon(Paths.icon("letter_%s.png" % l.lower())) answer.set_hint("Odpowiedź %s" % l) self.answers.append(answer) self.widget_layout.addWidget(answer) self.setStyleSheet(Styles.description_background)
def _extract(self): """ extract my paths from system environment variables variableName: base name of the environment variable derivedFrom: name of the package from which the paths of this package could be derived """ variableName = self._hintsToFindPaths derivedFrom = self._derivedFrom from os.path import join self.variableName = variableName self.env_variable_names = self._getEnvVarNames(variableName) base_desc = self.description desc_format_str = 'path to %s directory of ' + base_desc self.root = root = self._getRoot(desc_format_str, derivedFrom) include = self._getEnv('c headers', desc_format_str) clib = self._getEnv('c libraries', desc_format_str) python = self._getEnv('python modules', desc_format_str) from Paths import Paths return Paths( self.name, root=root, includes=[include], clibs=[clib], modules=[python], description=self.description, origin=self.mechanism, )
def setup_ui(self): """ Inicjalizacja interfejsu użytkownika. """ self.setObjectName("TestScoreWindow") self.setSizePolicy(self.get_size_policy()) self.setMinimumSize(QSize(500, 110)) self.setWindowTitle(self.window_title) self.setWindowIcon(QIcon(Paths.icon("window_icon.png"))) self.setStyleSheet(Styles.test_score_window_style) shadow = QGraphicsDropShadowEffect() shadow.setXOffset(0) shadow.setYOffset(5) shadow.setBlurRadius(10) self.control_panel = ControlPanel(self, Qt.AlignTop) self.score_label = self.control_panel.add_label(self.score) self.score_label.setStyleSheet( Styles.test_score_window_label_score_style + self.score_color_style) self.score_label.setGraphicsEffect(shadow) self.hint_label = self.control_panel.add_label(self.hint) self.hint_label.setStyleSheet( Styles.test_score_window_label_hint_style) self.setCentralWidget(self.control_panel)
def _organized_process(self): file = Fileoperation() file._process_files("Topology", "Ports", "Request") #read all the configure file self.switches = file.m_switch_number #self.source_ip = file.ip_src paths = Paths() paths._shortest_path_tree(file.receivers, file.graph) distance_graph = Distancegraph() distance_graph._minimal_spanning_tree(file.receivers, paths.path_sets) distance_graph._restore_paths(paths.path_sets) determine_path =Determinepaths() determine_path._src_to_multitree(file.m_switch_number, distance_graph.paths, file.graph, file.sender) generate_routing = Generaterouting() generate_routing._write_ports(file.m_total_number, distance_graph.paths, determine_path.multi_head, file.ports) self.wrotten_ports = generate_routing.map_ports self.proxy_port = generate_routing.proxy_port self.group_port = generate_routing.group_port self.head = generate_routing.head_switch
def __init__(self): QMainWindow.__init__(self) self.setObjectName("WelcomeWindow") self.resize(WINDOW_SIZE_X, WINDOW_SIZE_Y) self.setMinimumSize(QSize(WINDOW_SIZE_X, WINDOW_SIZE_Y)) self.setMaximumSize(QSize(WINDOW_SIZE_X, WINDOW_SIZE_Y)) self.setWindowTitle("WAWI ZUT") self.setStyleSheet(Styles.welcome_background) self.setWindowIcon(QIcon(Paths.icon("window_icon.png"))) self.central_widget = QWidget() self.layout = QVBoxLayout() self.setCentralWidget(self.central_widget) self.centralWidget().setLayout(self.layout) self.logo = QLabel(self) self.logo.setPixmap(QPixmap(Paths.icon("logo.png"))) self.logo.setAlignment(Qt.AlignCenter) self.layout.addWidget(self.logo, 10) self.layout.addWidget( add_label("\nWizualizacja Algorytmów", 12, False, Qt.AlignCenter), 10) self.layout.addWidget( add_label( "Wydział Informatyki \nZachodniopomorski Uniwersytet Technologiczny w Szczecinie\n", 10, False, Qt.AlignCenter), 1) self.layout.addWidget( add_label( "Oprogramowanie zrealizowane w ramach przedmiotu \nInżynierski Projekt Zespołowy 1", 10, False, Qt.AlignCenter), 1) self.layout.addWidget( add_label( "Autorzy: Marcin Jakubowski, Aliaksei Kavaliou, Piotr Podleżański, \nMateusz Smolarkiewicz, Łukasz Więckowski, Mykhailo Yelmikheiev", 10, False, Qt.AlignLeft), 1) self.layout.addWidget( add_label("Opiekun projektu: dr hab.inż. Imed El Fray", 10, False, Qt.AlignLeft), 1) self.layout.addWidget( add_label( "Konsultacja merytoryczna: dr hab.inż. Imed El Fray, \nmgr inż. Włodzimierz Chocianowicz, mgr inż. Gerard Wawrzyniak", 10, False, Qt.AlignLeft), 1)
def __init__(self): self.daemon = Pyro4.Daemon() self.paths = Paths() uri = self.daemon.register(Daemon(self)) with open(self.paths.DAEMON_PYRO_PATH, encoding='utf-8', mode='wt') as f: f.write(str(uri)) self.daemon.requestLoop()
def find(): g2c_lib, g2c_linkname = findLib() if not g2c_lib: liblist = [] else: liblist = [g2c_lib] from Paths import Paths paths = Paths(name, description="Linear Algebra PACKage", origin='search libg2c.so using infect utils', clibs=liblist) return paths
def __init__(self, loop_self): self._driver = Driver() if self._driver.not_found: print("Warning: The computer is not supported") exit(1) self.loop_self = loop_self # Get the user that the daemon should use # self._paths = Paths() _global_ccp = CCParser(self._paths.GLOBAL_CONFIG, 'Global alienware-kbl Configuration') self._user = _global_ccp.get_str_defval('boot_user', 'root') # Check if the user of the configuration file exists # try: pwd.getpwnam(self._user) except: user = getuser() print( 'Warning: The `{}` of the configuration file does not exist, it has been replaced by `{}`.' .format(self._user, user)) self._user = user self._paths = Paths(self._user) # Initialize the daemon # self._ccp = CCParser(self._paths.CONFIGURATION_PATH, 'GUI Configuration') self._controller = Controller(self._driver) self._indicator_pyro = False self._computer = self._driver.computer self.reload_configurations(self._user) self.set_lights(self._user, self._ccp.get_bool_defval('boot', True))
def __load_codes(self): """ Metoda importująca przykładowe kody do algorytmu. """ self.codes = [] codes_path = Paths.codes(self.name) codes_files = os.listdir(codes_path) for code_file in codes_files: code_file_path = os.path.join(codes_path, code_file) if os.path.isfile(code_file_path) and code_file.split(".")[-1].lower() == "html": code = Code.from_file(code_file_path) self.codes.append(code)
def __init__(self, main_widget: QWidget, algorithm: Algorithm): self.algorithm = algorithm self.main_widget = main_widget self.control_panel_bottom = self.main_widget.middle_widget.right_widget.bottom_control_panel self.center = self.main_widget.middle_widget.left_widget self.description_widget = None self.internal_widgets = [] self.play_icon = Paths.icon("play.png") self.pause_icon = Paths.icon("pause.png") self.text_box_label = None self.text_box = None self.icon_panel = None self.first_step_button = None self.previous_step_button = None self.next_step_button = None self.last_snapshot_button = None self.play_button = None self.slider = None self.is_playing = False self.setup_control_panel() self.current_snapshot_index = 0 self.update_playing_button()
def from_file(path: str): """ Wczytuje obiekt Code z pliku. Nazwa pliku do pierwszej kropki jest interpretowana jako nazwa języka. Parametry: path - ścieżka do pliku. Powrót: obiekt klasy Code Przykład: >>> code = Code.fromFile("algorithm/example/c++.cpp") """ code = Code() code.path = path code.url = QUrl.fromLocalFile(code.path) code.language = os.path.basename(path).split(".")[0] icon_file = code.language + ".png" code.icon = Paths.icon(icon_file) if not os.path.isfile(code.icon): code.icon = Paths.icon("code.png") return code
def __init__(self, path_list=DEFAULT_PATH_LIST, include_cwd=DEFAULT_INCLUDE_CWD, file_list=DEFAULT_FILE_LIST, output_dir=DEFAULT_OUTPUT_DIR, config_file_path=DEFAULT_CONFIG_FILE_PATH): self.paths = Paths(*path_list, include_cwd=include_cwd) self.include_cwd = include_cwd self.file_list = file_list self.output_dir = output_dir if os.path.exists(config_file_path): print config_file_path self.config = Configuration(config_file_path) else: self.config = self._create_default_configuration()
def set_profile(self, user, profile): """ Set a profile from the existing profiles. + 'profile' is the profile name """ if user != self._user: self._user = user self._paths = Paths(user) self.reload_configurations(user, False, False) if profile in Configuration.profiles.keys(): self._theme = Configuration.profiles[profile] self.profile_name = profile self._iluminate_keyboard() self._iluminate_keyboard()
def __init__(self, self_main): self._ = self_main self.paths = Paths() # Status variables for the loop # self.current_code = None self.check_daemon = True # GUI stuff # self.indicator = appindicator.Indicator.new_with_path( 'alienware-kbl-indicator', self.paths.NO_DAEMON_ICON, appindicator.IndicatorCategory.APPLICATION_STATUS, os.path.dirname(os.path.realpath(__file__))) self.indicator.set_status(appindicator.IndicatorStatus.ACTIVE) self.menu = Gtk.Menu() self.profiles_menu = Gtk.MenuItem(label=TEXT_PROFILES) self.menu.append(self.profiles_menu) self.submenu_profiles = Gtk.Menu() self.profiles_menu.set_submenu(self.submenu_profiles) item = Gtk.MenuItem(label=TEXT_START_THE_GUI) item.connect('activate', self.on_menuitem_gui) self.menu.append(item) self.switch_state = Gtk.MenuItem(label=TEXT_SWICH_STATE) self.switch_state.connect('activate', self.on_menuitem_change) self.menu.append(self.switch_state) item = Gtk.MenuItem(TEXT_EXIT) item.connect('activate', self.on_menuitem_exit) self.menu.append(item) self.menu.show_all() self.indicator.set_menu(self.menu) self.set_code(666) threading.Thread(target=self.daemon_check).start()
def reload_configurations(self, user, indicator=True, set_default=True): if user != self._user: self._user = user self._paths = Paths(user) Configuration.LOAD_profiles(self._computer, self._paths.PROFILES_PATH) if set_default: _, self.profile_name = Configuration.GET_last_configuration() self._theme = Configuration.profiles[self.profile_name] if self._indicator_pyro and indicator: try: self._indicator_pyro.load_profiles( list(Configuration.profiles.keys()), self.profile_name, self._lights_state) except Exception as e: print(format_exc())
def load_controls(self): """ Metoda tworząca klawisze oraz pola tekstowe odpowiedzialne za manipulację wizualizacją. """ self.add_textbox("Wartość elementu:", self.on_value_change, hint="Tutaj możesz wpisać dowolną wartość.") self.add_button("Dodaj", lambda: self.add_element(self.textbox_value), icon=Paths.icon("plus.png"), hint="Dodanie nowego elementu na koniec tablicy.") self.add_button( "Usuń", lambda: self.remove_element(self.textbox_value), icon=Paths.icon("minus.png"), hint="Usunięcie pierwszego napotkanego elementu o podanej wartości." ) self.add_button( "Usuń wszystkie", lambda: self.remove_all_elements(self.textbox_value), icon=Paths.icon("minus.png"), hint= "Usunięcie wszystkich napotkanych elementów o podanej wartości.") self.add_button( "Wyczyść", self.clear, icon=Paths.icon("clear.png"), hint= "Usunięcie wszystkich elementów oraz przywrócenie stanu początkowego." ) self.add_button("Losowe dane", self.random_data, icon=Paths.icon("random.png"), hint="Wylosowanie danych z ustawionego przedziału.") self.add_button( "Przemieszaj", self.shuffle, icon=Paths.icon("shuffle.png"), hint="Zamiana kolejności wszystkich elementów w tablicy.") self.add_button("Wykonaj algorytm", self.execute, icon=Paths.icon("execute.png"), hint="Rozpoczęcie wykonywania algorytmu.", update=False)
def setup_ui(self): """ Inicjalizacja interfejsu użytkownika. """ self.setObjectName("SettingsWindow") self.resize(400, 265) size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size_policy.setHorizontalStretch(1) size_policy.setVerticalStretch(1) size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(size_policy) self.setMinimumSize(QSize(400, 265)) self.setWindowTitle(SettingsWindow.window_title) self.control_panel = ControlPanel(self, Qt.AlignTop) self.setStyleSheet(Styles.settings_background) self.setCentralWidget(self.control_panel) self.setWindowIcon(QIcon(Paths.icon("settings.png")))
def setup_ui(self): """ Inicjalizuje interfejs użytkownika. """ self.center.set_widget(QuestionsWidget) self.questions_widget = self.center.widget self.check_button = self.control_panel_bottom.add_button( "Zakończ test", Paths.icon("eye.png"), "Sprawdza test") self.check_button.clicked.connect(self.on_click_check) self.previous_button = self.control_panel_bottom.add_button( "Poprzednie", Paths.icon("backward.png"), "Poprzednie pytanie") self.previous_button.clicked.connect(self.on_click_previous) self.next_button = self.control_panel_bottom.add_button( "Następne", Paths.icon("forward.png"), "Następne pytanie") self.next_button.clicked.connect(self.on_click_next) for index, answer_button in enumerate(self.questions_widget.answers): answer_button.clicked.connect( (lambda i: lambda: self.on_click_answer(i))(index)) answer_button.label.clicked.connect( (lambda i: lambda: self.on_click_answer(i))(index)) self.control_icon_panel = self.control_panel_bottom.add_icon_panel() self.first_icon_button = self.control_icon_panel.add_button( Paths.icon("first.png"), "Pierwsze pytanie") self.first_icon_button.clicked.connect(self.on_click_first) self.previous_icon_button = self.control_icon_panel.add_button( Paths.icon("backward.png"), "Poprzednie pytanie") self.previous_icon_button.clicked.connect(self.on_click_previous) self.next_icon_button = self.control_icon_panel.add_button( Paths.icon("forward.png"), "Następne pytanie") self.next_icon_button.clicked.connect(self.on_click_next) self.last_icon_button = self.control_icon_panel.add_button( Paths.icon("last.png"), "Ostatnie pytanie") self.last_icon_button.clicked.connect(self.on_click_last)
def setup_ui(self): """ Inicjalizacja interfejsu użytkownika. """ # Window config self.setObjectName("MainWindow") self.resize(800, 620) size_policy = QSizePolicy(QSizePolicy.Preferred, QSizePolicy.Preferred) size_policy.setHorizontalStretch(1) size_policy.setVerticalStretch(1) size_policy.setHeightForWidth(self.sizePolicy().hasHeightForWidth()) self.setSizePolicy(size_policy) self.setMinimumSize(QSize(1280, 720)) self.setWindowTitle(MainWindow.window_title) # Main widget self.main_widget = MainWidget(self) self.main_widget.setObjectName("main_widget") self.setStyleSheet(Styles.main_background) self.setCentralWidget(self.main_widget) self.setWindowIcon(QIcon(Paths.icon("window_icon.png")))
def main(): parser = ArgumentParser( description= 'Download videos on your server from some video platforms via http requests using youtube-dl', formatter_class=RawTextHelpFormatter) parser.add_argument('-v', '--version', action='version', version=__version__) parser.add_argument('-u', '--update', action='store_true', help='update or install youtube-dl and exit\n\n') parser.add_argument('-s', '--server', type=str, default='0.0.0.0', help='select server (0.0.0.0 by default)') parser.add_argument('-p', '--port', type=int, default=49148, help='select server listening port (49148 by default)') parser.add_argument('--verbose', action='store_true', help='show what the program is doing') args = parser.parse_args() try: paths = Paths() if (args.update): update(paths, args.verbose) else: checkYoutubedl(paths, args.verbose) checkDownloadFolder(paths, args.verbose) runServer(args.server, args.port, args.verbose) except KeyboardInterrupt: sys.exit(0)
def load_controls(self): """ Metoda tworząca klawisze oraz pola tekstowe odpowiedzialne za manipulację wizualizacją. """ self.add_textbox("Wartość elementu:", self.on_value_change, hint="Tutaj możesz wpisać dowolną wartość.") self.add_button("Push back", self.push_back, icon=Paths.icon("plus.png"), hint="Dodanie nowego elementu na koniec listy.") self.add_button("Push front", self.push_front, icon=Paths.icon("plus.png"), hint="Dodanie nowego elementu na początek listy.") self.add_button("Pop back", self.pop_back, icon=Paths.icon("minus.png"), hint="Pobranie i usunięcie elementu z końca listy.") self.add_button( "Pop front", self.pop_front, icon=Paths.icon("minus.png"), hint="Pobranie i usunięcie elementu z początku listyy.") self.add_button( "Usuń", self.remove, icon=Paths.icon("minus.png"), hint="Usunięcie pierwszego napotkanego elementu o podanej wartości." ) self.add_button( "Wyczyść", self.clear, icon=Paths.icon("clear.png"), hint= "Usunięcie wszystkich elementów oraz przywrócenie stanu początkowego." ) self.add_button("Losowe dane", self.random_data, icon=Paths.icon("random.png"), hint="Wylosowanie danych z ustawionego przedziału.")
def _createPaths(self, root): include = self.getSubdirectory( root, 'c headers', ) clib = self.getSubdirectory( root, 'c libraries', ) python = self.getSubdirectory( root, 'python modules', ) return Paths( self.name, root=root, includes=[include], clibs=[clib], modules=[python], description=self.description, origin=self.mechanism, )
import argparse parser = argparse.ArgumentParser(description="Input file delivery") parser.add_argument("--input-file", type=str, dest="input_file", nargs='*', default=None) parser.add_argument("--index", type=int, dest="index", default=None) parser.add_argument("--lambdas", type=str, dest="lambdas", default=None) args = parser.parse_args() input_file = args.input_file index = args.index lambdas = args.lambdas hn = socket.gethostname() pt = Paths(index, hn) directory = pt.dst_dir fmdst_file = os.path.join(directory, pt.fileprefix()) print lambdas class fmProd(object): """ The fmDST production task to be run on each core of the node. Input parameters: njob - number of the current job nevt - number of events to be processed dsname - output dataset name inputs - list of input files """
def extract(self): """ extract my paths from sysconfig, which is a module in distutils """ something = self._hintsToFindPaths derivedFrom = self._derivedFrom if something is None: something = sysconfig include_dirs = [] # Make sure Python's include directories (for Python.h, pyconfig.h, # etc.) are in the include search path. py_include = something.get_python_inc() plat_py_include = something.get_python_inc(plat_specific=1) # Put the Python "system" include dir at the end, so that # any local include dirs take precedence. include_dirs.append(py_include) if plat_py_include != py_include: include_dirs.append(plat_py_include) pass library_dirs = [ something.get_config_var( 'LIBDEST' ) ] runtimelib_dirs = [] # for extensions under windows use different directories # for Release and Debug builds. # also Python's library directory must be appended to library_dirs if os.name == 'nt': library_dirs.append(os.path.join(sys.exec_prefix, 'libs')) # Append the source distribution include and library directories, # this allows distutils on windows to work in the source tree include_dirs.append(os.path.join(sys.exec_prefix, 'PC')) library_dirs.append(os.path.join(sys.exec_prefix, 'PCBuild')) pass # OS/2 (EMX) doesn't support Debug vs Release builds, but has the # import libraries in its "Config" subdirectory if os.name == 'os2': library_dirs.append(os.path.join(sys.exec_prefix, 'Config')) pass # for extensions under Cygwin and AtheOS Python's library directory must be # appended to library_dirs if sys.platform[:6] == 'cygwin' or sys.platform[:6] == 'atheos': if str.find(sys.executable, sys.exec_prefix) != -1: # building third party extensions library_dirs.append( os.path.join(sys.prefix, "lib", "python" + get_python_version(), "config")) pass else: # building python standard extensions library_dirs.append('.') pass pass root = None; modules = None #for windows nt we may want to know root and site-packages if os.name == "nt": from NTPythonRoot import pythonInstallationPath as root modules = [os.path.join(root, "Lib", "site-packages")] #config dir config_dir = something.get_config_var( 'LIBPL' ) from Paths import Paths ret = Paths( self.name, root = root, includes= include_dirs, clibs= library_dirs, modules= modules, description = self.description, origin = self.mechanism) ret.config_dir = config_dir return ret